use relative wss url

This commit is contained in:
creeper123123321 2021-02-18 05:20:21 -03:00 committed by GitHub
parent d40d7d594c
commit 0ffb17b15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,9 @@ if (urlParams.get("mcauth_success") == "false") {
// WS
function defaultWs() {
return window.location.host == "viaversion.github.io" || !window.location.host ? "wss://localhost:25543/ws" : "wss://" + window.location.host + "/ws";
let url = new URL("ws", new URL(location));
url.protocol = "wss";
return window.location.host == "viaversion.github.io" || !window.location.host ? "wss://localhost:25543/ws" : url.toString();
}
function getWsUrl() {
let url = localStorage.getItem("ws-url") || defaultWs();