mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
refactoring
This commit is contained in:
parent
a4c9a0b117
commit
274d609b71
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user