diff options
author | Devaev Maxim <[email protected]> | 2021-05-17 10:40:20 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-05-17 10:40:20 +0300 |
commit | 274d609b71de508d66b96baa24ad80ad8b4885eb (patch) | |
tree | e23bb955769ce7904e1c2d3d174071760a864578 /web | |
parent | a4c9a0b117e7805129bf19d31ba9f7166622c579 (diff) |
refactoring
Diffstat (limited to 'web')
-rw-r--r-- | web/share/js/kvm/session.js | 3 | ||||
-rw-r--r-- | web/share/js/tools.js | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/web/share/js/kvm/session.js b/web/share/js/kvm/session.js index 894dc6f1..b8fee992 100644 --- a/web/share/js/kvm/session.js +++ b/web/share/js/kvm/session.js @@ -205,8 +205,7 @@ export function Session() { let http = tools.makeRequest("GET", "/api/auth/check", function() { if (http.readyState === 4) { if (http.status === 200) { - let proto = (location.protocol === "https:" ? "wss" : "ws"); - __ws = new WebSocket(`${proto}://${location.host}/api/ws`); + __ws = new WebSocket(`${tools.https ? "wss" : "ws"}://${location.host}/api/ws`); __ws.onopen = __wsOpenHandler; __ws.onmessage = __wsMessageHandler; __ws.onerror = __wsErrorHandler; diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 521cb1a0..02c6e637 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -240,6 +240,8 @@ export var tools = new function() { }; }; this.info("Browser:", this.browser); + + this.https = (location.protocol === "https:"); }; export var $ = (id) => document.getElementById(id); |