Make onboarding tour install-wide instead of per-browser

Persist onboardingCompleted flag server-side via /api/v1/config so the
tour only auto-starts once per DashCaddy installation, not on every
new browser that connects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 21:58:10 -07:00
parent 2d1944fd55
commit 063bf948b1
5 changed files with 56 additions and 8 deletions

View File

@@ -29,6 +29,7 @@
constructor(storageKey = 'dashcaddy_onboarding') {
this.storageKey = storageKey;
this.storageVersion = '1.0';
this.installOnboardingCompleted = typeof SITE !== 'undefined' && SITE.onboardingCompleted === true;
// Initialize storage if it doesn't exist
this._initializeStorage();
@@ -159,6 +160,36 @@
return state.tourCompleted === true;
}
/**
* Check if onboarding has already been consumed for this install.
* @returns {boolean} True if auto-onboarding should stay suppressed
*/
isInstallOnboardingCompleted() {
return this.installOnboardingCompleted === true;
}
/**
* Persist install-wide onboarding completion so it only auto-starts once.
* Manual Help Tour restarts are still allowed via local state reset.
* @returns {Promise<void>}
*/
async markInstallOnboardingCompleted() {
if (this.installOnboardingCompleted) return;
this.installOnboardingCompleted = true;
if (typeof SITE !== 'undefined') SITE.onboardingCompleted = true;
try {
await secureFetch('/api/v1/config', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ onboardingCompleted: true })
});
} catch (error) {
console.error('[ProgressTracker] Failed to persist install onboarding state:', error);
}
}
/**
* Mark the entire tour as completed
*/