From 58009adfef769334663235eaab06417b60e7f82d Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 18 May 2021 16:49:22 +0100 Subject: [PATCH] Update url when its contains an unknown server --- src/main.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.ts b/src/main.ts index a6854d4..0527253 100644 --- a/src/main.ts +++ b/src/main.ts @@ -93,6 +93,11 @@ API.validateConfiguration().then((config) => { const lastSegment = window.location.pathname.split('/').pop(), serverName = lastSegment && config.has(lastSegment) ? lastSegment : config.keys().next().value; + //Update url if server doesn't exist + if(serverName !== lastSegment) { + window.history.replaceState({}, '', store.state.servers.get(serverName)!.url + window.location.hash); + } + store.commit(MutationTypes.SET_CURRENT_SERVER, serverName); } else { store.commit(MutationTypes.SET_CURRENT_SERVER, config.keys().next().value);