diff options
author | Maxim Devaev <[email protected]> | 2024-03-25 01:01:21 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-03-25 01:29:43 +0200 |
commit | 71e5e4d138ebc36644b022aa18e5990caa4bf9c5 (patch) | |
tree | 4ee39613616ef9bdd403c82a0e6ad34ec11315b7 /web/share/js/vnc | |
parent | 1d48ba0a5a4f347321f7f46cd0fe317e3c87d3df (diff) |
refactoring
Diffstat (limited to 'web/share/js/vnc')
-rw-r--r-- | web/share/js/vnc/main.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/web/share/js/vnc/main.js b/web/share/js/vnc/main.js index 440e51d4..965c7e9e 100644 --- a/web/share/js/vnc/main.js +++ b/web/share/js/vnc/main.js @@ -31,19 +31,17 @@ export function main() { } function __loadKvmdInfo() { - let http = tools.makeRequest("GET", "/api/info", function() { - if (http.readyState === 4) { - if (http.status === 200) { - let vnc_port = JSON.parse(http.responseText).result.extras.vnc.port; - $("vnc-text").innerHTML = ` - <span class="code-comment"># How to connect using the Linux terminal:<br> - $</span> vncviewer ${window.location.hostname}::${vnc_port} - `; - } else if (http.status === 401 || http.status === 403) { - document.location.href = "/login"; - } else { - setTimeout(__loadKvmdInfo, 1000); - } + tools.httpGet("/api/info", function(http) { + if (http.status === 200) { + let vnc_port = JSON.parse(http.responseText).result.extras.vnc.port; + $("vnc-text").innerHTML = ` + <span class="code-comment"># How to connect using the Linux terminal:<br> + $</span> vncviewer ${window.location.hostname}::${vnc_port} + `; + } else if (http.status === 401 || http.status === 403) { + document.location.href = "/login"; + } else { + setTimeout(__loadKvmdInfo, 1000); } }); } |