fix: improve onboarding auth UX

This commit is contained in:
Peter Steinberger
2026-01-02 15:03:38 +01:00
parent f57f892409
commit ad9d6f616d
5 changed files with 37 additions and 7 deletions

View File

@@ -186,6 +186,7 @@ export class ClawdisApp extends LitElement {
this.syncThemeWithSettings();
this.attachThemeListener();
window.addEventListener("popstate", this.popStateHandler);
this.applySettingsFromUrl();
this.connect();
this.startNodesPolling();
}
@@ -334,6 +335,20 @@ export class ClawdisApp extends LitElement {
}
}
private applySettingsFromUrl() {
if (!window.location.search) return;
const params = new URLSearchParams(window.location.search);
const token = params.get("token")?.trim();
if (!token) return;
if (!this.settings.token) {
this.applySettings({ ...this.settings, token });
}
params.delete("token");
const url = new URL(window.location.href);
url.search = params.toString();
window.history.replaceState({}, "", url.toString());
}
setTab(next: Tab) {
if (this.tab !== next) this.tab = next;
void this.refreshActiveTab();