From 0d5aeebd8e6b35005c954eb9318d54da7e3b3ad3 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Wed, 15 Apr 2026 11:33:44 -0400 Subject: [PATCH] fix: PWA install banner uses root-domain cookie for cross-subdomain dismiss localStorage is per-subdomain so dismissing on demo.rspace.online didn't persist to jeff.rspace.online. Now uses a .rspace.online cookie (10yr max-age) so one dismiss covers all subdomains. Co-Authored-By: Claude Opus 4.6 --- server/shell.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/shell.ts b/server/shell.ts index 8511adf7..94fa1e09 100644 --- a/server/shell.ts +++ b/server/shell.ts @@ -398,14 +398,17 @@ export function renderShell(opts: ShellOptions): string { } // Install banner — browser only (not shown in installed PWA) - // Permanently dismissed once closed or installed (localStorage key persists) + // Permanently dismissed once closed or installed. + // Uses root-domain cookie so dismissal persists across all subdomains. if (!isStandalone) { - const installDismissed = () => localStorage.getItem('rspace_install_dismissed') === '1'; + const installDismissed = () => document.cookie.includes('rspace_install_dismissed=1'); const dismissInstall = () => { const b = document.getElementById('pwa-install-banner'); if (b) b.style.display = 'none'; document.body.classList.remove('rspace-banner-visible'); - localStorage.setItem('rspace_install_dismissed', '1'); + const host = location.hostname; + const domainPart = host.includes('.') ? '; domain=.' + host.split('.').slice(-2).join('.') : ''; + document.cookie = 'rspace_install_dismissed=1; path=/; max-age=315360000; SameSite=Lax' + domainPart; }; window.addEventListener("beforeinstallprompt", (e) => {