Pass apiUrl through OIDC redirect so SPA has it on return
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

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=...
This commit is contained in:
2026-07-14 00:18:21 +02:00
parent cea67ccd15
commit bcf2b265c5
2 changed files with 5 additions and 2 deletions

View File

@@ -103,7 +103,10 @@ export async function startLogin(): Promise<void> {
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
}

View File

@@ -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')