diff --git a/static/web_panel/pages/dashboard.js b/static/web_panel/pages/dashboard.js index 8be95fa..61cad43 100644 --- a/static/web_panel/pages/dashboard.js +++ b/static/web_panel/pages/dashboard.js @@ -50,7 +50,8 @@ window.DashboardModule = { } var base = window.location.pathname.split("/").slice(0, 2).join("/"); - var ws = new WebSocket("ws://" + location.host + base + "/api/system/ws"); + var proto = location.protocol === 'https:' ? 'wss://' : 'ws://'; + var ws = new WebSocket(proto + location.host + base + "/api/system/ws"); self.ws = ws; ws.onopen = function() { diff --git a/static/web_panel/pages/logs.js b/static/web_panel/pages/logs.js index 1ac02bd..681e048 100644 --- a/static/web_panel/pages/logs.js +++ b/static/web_panel/pages/logs.js @@ -25,7 +25,8 @@ window.LogsModule = { } var base = window.location.pathname.split("/").slice(0, 2).join("/"); - var ws = new WebSocket("ws://" + location.host + base + "/api/logs/ws"); + var proto = location.protocol === 'https:' ? 'wss://' : 'ws://'; + var ws = new WebSocket(proto + location.host + base + "/api/logs/ws"); self.ws = ws; ws.onopen = function() {