From bcf2b265c576ac8fede97b344ee63d1aaecf3034 Mon Sep 17 00:00:00 2001 From: dtoro Date: Tue, 14 Jul 2026 00:18:21 +0200 Subject: [PATCH] Pass apiUrl through OIDC redirect so SPA has it on return The apiUrl configured on the Config page was lost when the webview navigated away to localhost and back. Now it's included in the return URL as ?desktop=1&apiUrl=...&token=... --- web/src/lib/oidc.ts | 5 ++++- web/src/main.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/lib/oidc.ts b/web/src/lib/oidc.ts index 0916c47..c5bbed1 100644 --- a/web/src/lib/oidc.ts +++ b/web/src/lib/oidc.ts @@ -103,7 +103,10 @@ export async function startLogin(): Promise { if (isDesktop) { const apiUrl = getConfig().apiUrl || '' - const ret = encodeURIComponent(location.origin + location.pathname.replace(/\/$/, '') + '?desktop=1') + const ret = encodeURIComponent( + location.origin + location.pathname.replace(/\/$/, '') + + '?desktop=1&apiUrl=' + encodeURIComponent(apiUrl) + ) location.href = `http://127.0.0.1:18901/oidc/start?apiUrl=${encodeURIComponent(apiUrl)}&ret=${ret}` return } diff --git a/web/src/main.ts b/web/src/main.ts index 7f5dd59..312046a 100644 --- a/web/src/main.ts +++ b/web/src/main.ts @@ -7,7 +7,7 @@ function handleDesktopToken() { const params = new URLSearchParams(location.search) const token = params.get('token') if (token && new URLSearchParams(location.search).has('desktop')) { - const apiUrl = getConfig().apiUrl || '' + const apiUrl = params.get('apiUrl') || getConfig().apiUrl || '' setConfig({ apiUrl, token, isDesktop: true }) initConfig({ apiUrl, token, isDesktop: true }) params.delete('token')