momic templating from sw in ws

This commit is contained in:
Simon Knott 2024-11-19 14:14:41 +01:00
parent c941c86c13
commit cbdd432954
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -47,11 +47,10 @@ const xtermDataSource: XtermDataSource = {
}; };
const searchParams = new URLSearchParams(window.location.search); const searchParams = new URLSearchParams(window.location.search);
const guid = searchParams.get('ws'); let testServerBaseUrl = new URL('../', window.location.href);
let testServerBaseUrl = new URL(window.location.href);
if (testServerBaseUrl.searchParams.has('server')) if (testServerBaseUrl.searchParams.has('server'))
testServerBaseUrl = new URL(testServerBaseUrl.searchParams.get('server')!, testServerBaseUrl); testServerBaseUrl = new URL(testServerBaseUrl.searchParams.get('server')!, testServerBaseUrl);
const wsURL = new URL(`../${guid}`, testServerBaseUrl); const wsURL = new URL(searchParams.get('ws')!, testServerBaseUrl);
wsURL.protocol = (wsURL.protocol === 'https:' ? 'wss:' : 'ws:'); wsURL.protocol = (wsURL.protocol === 'https:' ? 'wss:' : 'ws:');
const queryParams = { const queryParams = {
args: searchParams.getAll('arg'), args: searchParams.getAll('arg'),