From 178313ec2bb2d9828fd1c9fea3f36660e9ea6587 Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 19 Jan 2024 04:57:53 +0000 Subject: [PATCH] fixed connect() not actually changing server hosts --- public/scripts/terminal.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/scripts/terminal.js b/public/scripts/terminal.js index 5445ab7..7e59e34 100644 --- a/public/scripts/terminal.js +++ b/public/scripts/terminal.js @@ -91,7 +91,7 @@ to help you feel a little more comfortable, i've prepared some commands for you: * closes any existing websocket connection and attempts to create a new one. * @param {string} server_url - the server websocket url to connect to. */ -export async function connect(url) { +export async function connect(server_url) { if (client && client.readyState == 1) { // OPEN client.close(); @@ -144,12 +144,12 @@ function add_client_events(client) { console.log(`Successfully connected to ${server_url}.`); server_indicator.innerText = function() { - if (client.url.startsWith("ws://")) - return client.url.slice(5, -1); - else if (client.url.startsWith("wss://")) - return client.url.slice(6, -1); + if (server_url.startsWith("ws://")) + return server_url.slice(5, -1); + else if (server_url.startsWith("wss://")) + return server_url.slice(6, -1); else - return client.url; + return server_url; }(); add_system_message(`Connection successful.\n\n`);