Web App: two sites, one tab — a server you can switch
Two locations means two full stacks, and until now the app could only ever see the one that served it. The login screen's "Server settings" could point it elsewhere, but as a global swap: it replaced the server rather than adding one, and forgot the session you already had. There is now a server picker at the bottom of the app rail, after signing in rather than on the login screen. It names the server you are reading — which matters most when both sites look identical — and switches in a click. Each server is its own PocketBase with its own users, so nothing is federated: you sign into each one once and a token is kept per server. The home server is the one that served the app, reached same-origin through the BFF proxy; any other is added by address and called straight from the browser, which asks nothing new of the network — an API Server the phone app can reach is internet-facing already. Two things the switch turned out to need: Views load on mount, so swapping the session alone left B's user looking at A's cars. The RouterView is keyed on the active server and a switch returns to the garage, since record ids belong to the server that issued them. A request now carries the id of the server it went out to, and a 401 clears that session rather than whatever is active when the answer lands. A page fires half a dozen calls at once: the first rejection used to switch away and the rest then cleared the session of the server it had switched to, turning one stale remote token into a full sign-out. A remote session expiring falls back to the home server with the entry left in place to sign into again. Only Log out clears them all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
00d4c17392
commit
f521d2b220
11 files changed
+757
-131
No files matched your search
@@ -78,11 +78,28 @@
|
||||
"hidePassword": "Skjul adgangskode",
|
||||
"submit": "Log ind",
|
||||
"submitting": "Logger ind…",
|
||||
"failed": "Login mislykkedes",
|
||||
"serverSettings": "Serverindstillinger",
|
||||
"apiServerUrl": "API-serverens adresse",
|
||||
"leaveBlank": "Lad feltet stå tomt for at bruge standarden ({url}).",
|
||||
"resetToDefault": "Nulstil til standard"
|
||||
"failed": "Login mislykkedes"
|
||||
},
|
||||
|
||||
"servers": {
|
||||
"title": "Servere",
|
||||
"home": "Denne server",
|
||||
"sameOrigin": "Leveret sammen med appen",
|
||||
"switchHint": "Skift hvilken server appen læser fra",
|
||||
"add": "Tilføj server",
|
||||
"addTitle": "Tilføj en server",
|
||||
"name": "Navn",
|
||||
"namePlaceholder": "Hjemmegarage",
|
||||
"url": "Adresse",
|
||||
"urlHint": "API-serverens offentlige adresse, f.eks. https://garage.example.com — /api tilføjes automatisk, hvis du udelader stien.",
|
||||
"urlHomeHint": "Lad feltet stå tomt for at bruge den server, der kører denne app.",
|
||||
"connect": "Forbind",
|
||||
"connecting": "Forbinder…",
|
||||
"connected": "Forbundet",
|
||||
"notConnected": "Ikke forbundet — log ind for at skifte",
|
||||
"signOut": "Log ud af denne server",
|
||||
"removeConfirm": "Fjern {name}? Den gemte session glemmes også.",
|
||||
"unknown": "Ukendt server"
|
||||
},
|
||||
|
||||
"dashboard": {
|
||||
|
||||
Reference in new issue
Block a user