Let browser construct URL string for us

Likely a lot safer for corner cases than us trying to figure this out
ourselves.
This commit is contained in:
Pierre Ossman 2024-08-08 14:40:04 +02:00
parent 06f14a5cd3
commit 074fa1a40f
1 changed files with 6 additions and 5 deletions

View File

@ -1033,16 +1033,17 @@ const UI = {
let url;
url = UI.getSetting('encrypt') ? 'wss' : 'ws';
url = new URL("https://" + host);
url += '://' + host;
url.protocol = UI.getSetting('encrypt') ? 'wss:' : 'ws:';
if (port) {
url += ':' + port;
url.port = port;
}
url += '/' + path;
url.pathname = '/' + path;
try {
UI.rfb = new RFB(document.getElementById('noVNC_container'), url,
UI.rfb = new RFB(document.getElementById('noVNC_container'),
url.href,
{ shared: UI.getSetting('shared'),
repeaterID: UI.getSetting('repeaterID'),
credentials: { password: password } });