From 4aa7b95a9c65e1986b9626c1d95523be57852492 Mon Sep 17 00:00:00 2001
From: SH <sh@analogic.cz>
Date: Thu, 6 Feb 2020 16:24:38 +0100
Subject: [PATCH] use js scheme detection

---
 modules/http/http.lua.in     | 1 -
 modules/http/static/kresd.js | 2 +-
 modules/http/static/main.tpl | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/http/http.lua.in b/modules/http/http.lua.in
index 4e6967cd8..7d022a448 100644
--- a/modules/http/http.lua.in
+++ b/modules/http/http.lua.in
@@ -115,7 +115,6 @@ local function serve_root()
 		end
 		-- Return index page
 		return data
-		        :gsub('{{ secure }}', stream:checktls() and 'true' or 'false')
 		        :gsub('{{ snippets }}', table.concat(rsnippets, '\n'))
 	end
 end
diff --git a/modules/http/static/kresd.js b/modules/http/static/kresd.js
index ceb16ed1a..4b4047f4e 100644
--- a/modules/http/static/kresd.js
+++ b/modules/http/static/kresd.js
@@ -332,7 +332,7 @@ $(function() {
 	}
 
 	/* WebSocket endpoints */
-	var wsStats = (secure ? 'wss://' : 'ws://') + location.host + '/stats';
+	var wsStats = ('https:' == document.location.protocol ? 'wss://' : 'ws://') + location.host + '/stats';
 	var ws = new Socket(wsStats);
 	ws.onmessage = function(evt) {
 		var data = JSON.parse(evt.data);
diff --git a/modules/http/static/main.tpl b/modules/http/static/main.tpl
index d05522cb5..c6bdab321 100644
--- a/modules/http/static/main.tpl
+++ b/modules/http/static/main.tpl
@@ -4,7 +4,6 @@
 <title>{{ title }}</title>
 <script type="text/javascript">
 	var host = "{{ host }}";
-	var secure = {{ secure }};
 </script>
 <script src="jquery.js"></script>
 <script src="bootstrap.min.js"></script>
-- 
GitLab