From aa6ebf12a02ea1330be4d51ea7d82160f772f404 Mon Sep 17 00:00:00 2001 From: Holly Date: Fri, 26 Apr 2024 10:38:46 +0100 Subject: [PATCH] decide local / live depending on url --- client/Terminal-00-Multiuser.user.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/Terminal-00-Multiuser.user.js b/client/Terminal-00-Multiuser.user.js index 403f3c1..d87d0d8 100644 --- a/client/Terminal-00-Multiuser.user.js +++ b/client/Terminal-00-Multiuser.user.js @@ -258,7 +258,8 @@ kbd { } }, 1000); - fetch(`http://localhost:39194/api/version`, { method: "post" }).then(response => { + const versionFetchAddress = window.location.href.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/version" : "https://multiprobe.eusv.net/api/version"; + fetch(versionFetchAddress, { method: "post" }).then(response => { console.log("hi"); response.text().then(versionNumberRaw => { const versionNumber = parseInt(versionNumberRaw); @@ -442,7 +443,7 @@ kbd { function doConnect(apiKey) { const Buffer = getBufferClass(); - ws = new WebSocket(window.location.href.includes("//localhost:") ? "ws://localhost:39195" : "wss://ws.eusv.net/t00mp"); + ws = new WebSocket(window.location.href.includes("//localhost:") ? "ws://localhost:38195" : "wss://ws.eusv.net/t00mp"); let keepAliveInterval; ws.onopen = () => { otherCursors.innerHTML = ""; @@ -737,7 +738,7 @@ kbd { doNotButton.disabled = true; title.innerText = "Authenticating..."; - fetch(window.location.href.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:39194/api/login" : "https://multiprobe.eusv.net/api/login", { + fetch(window.location.href.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/login" : "https://multiprobe.eusv.net/api/login", { method: "POST", body: `username=${encodeURIComponent(username.value)}&password=${encodeURIComponent(password.value)}`, headers: {