From dc54ca89f2639123a8e66ab38c6b8aeabeaf45c3 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Mon, 20 Nov 2023 00:06:17 +0100 Subject: Need to adjust http/s as well --- webAO/master.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'webAO/master.ts') diff --git a/webAO/master.ts b/webAO/master.ts index 000f816..f12674f 100644 --- a/webAO/master.ts +++ b/webAO/master.ts @@ -138,26 +138,29 @@ function getCachedServerlist(): AOServer[] { } function processServerlist(serverlist: AOServer[]) { - const clientURL: string = `${protocol}//${host}/client.html`; for (let i = 0; i < serverlist.length; i++) { const server = serverlist[i]; let port = 0; - let protocol = ''; + let ws_protocol = ''; + let http_protocol = ''; if (server.ws_port) { port = server.ws_port; - protocol = 'ws'; + ws_protocol = 'ws'; + http_protocol = 'http'; } if (server.wss_port) { port = server.wss_port; - protocol = 'wss'; + ws_protocol = 'wss'; + http_protocol = 'https'; } if (port === 0 || protocol === '') { console.warn(`Server ${server.name} has no websocket port, skipping`) continue; } - const connect = `${protocol}://${server.ip}:${port}`; + const clientURL: string = `${http_protocol}//${host}/client.html`; + const connect = `${ws_protocol}://${server.ip}:${port}`; const serverName = server.name; server.online = `Players: ${server.players}`; servers.push(server); -- cgit