From a30d1b7eca91852d76101025de02a3097d58dd8e Mon Sep 17 00:00:00 2001 From: Marekkon5 Date: Sun, 21 Jan 2024 15:47:55 +0100 Subject: [PATCH] WebUI detect URL --- client/src/scripts/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/scripts/utils.ts b/client/src/scripts/utils.ts index 9b0ba057..d150a60b 100644 --- a/client/src/scripts/utils.ts +++ b/client/src/scripts/utils.ts @@ -1,16 +1,16 @@ // Returns the WebSocket server URL function wsUrl(): string { - return `ws://${window.location.hostname}:36913/ws`; + return import.meta.env.DEV ? `ws://${window.location.hostname}:36913/ws` : `ws://${window.location.host}/ws`; } // Returns the HTTP server URL function httpUrl(): string { - return `http://${window.location.hostname}:36913`; + return import.meta.env.DEV ? `http://${window.location.hostname}:36913` : `${window.location.origin}`; } // Returns the Spotify redirect URL function spotifyUrl(): string { - return `http://127.0.0.1:36913/spotify`; + return `${httpUrl()}/spotify`; } // Tag value separators