From e5974d46635b9db99c9ba1f14d34a0ab72605e6a Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 21 Jun 2019 19:48:16 +0200 Subject: [PATCH] Prefer isSecureContext if available --- js/privatebin.js | 5 +++++ tpl/bootstrap.php | 4 ++-- tpl/page.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 45bd250..bf30a52 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -4577,6 +4577,11 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ function isInsecureConnection() { + // use .isSecureContext if available + if (window.isSecureContext === true || window.isSecureContext === false) { + return !window.isSecureContext; + } + const url = new URL(window.location); // HTTP is obviously insecure diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index eec3807..d14dccc 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ if ($MARKDOWN): endif; ?> - + @@ -91,7 +91,6 @@ if ($isCpct): endif; if ($isDark): ?> class="dark-theme">