Between 48f5e35 (07.09., registerType: 'autoUpdate') and 5b5f4ca (10.09.,
switched to 'prompt') every client that cached the app froze: the new
worker sits in `waiting` and the only code that could release it - the
update toast - lives in the build behind that worker. Their next update
never arrives, and Pages deletes the hashed assets they still run from,
so the bundle they serve does not exist on the server any more. That is
how the feedback form went missing on client.webspeak3.de.
- Back to 'autoUpdate', with skipWaiting/clientsClaim spelled out: the
plugin only sets them when it also injects registerSW.js, so with
injectRegister: false the generated worker was byte-identical to the
'prompt' one. Verified in dist/sw.js.
- onNeedReload instead of onNeedRefresh: the worker takes over on its
own, the toast only decides *when* to reload, so nobody is thrown out
of a running connection.
- version.json plus a __BUILD_ID__ baked into the bundle, checked every
30 min and on tab focus, deliberately routed around the worker (not in
globPatterns, so never precached). If the server is on another build
and no new worker turns up, the worker is wedged and the button clears
registrations and caches instead of reloading into the same cache.
- Dismissing the toast snoozes for 30 min rather than for good.
Verified in headless Chromium against simulated deploys: a client stuck
on the old worker lands on the new bundle at the first plain F5.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
Previously the service worker used registerType: 'autoUpdate' with
the default injected register script - a new deploy would install
and activate a new SW in the background, but an already-open tab
kept running the old JS/CSS from memory with no indication a newer
version existed, short of a manual hard reload (or clearing SW/
caches by hand, which we had to do repeatedly while verifying
deploys this session).
Switch to registerType: 'prompt' and register the SW ourselves via
virtual:pwa-register/react (useRegisterSW), showing a small "new
version available" toast with a reload button when an update is
waiting. Also poll registration.update() hourly so long-lived tabs
notice updates without needing a fresh navigation.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Wire up vite-plugin-pwa: generates a web app manifest and a
precache-only service worker for the built app shell (JS/CSS/HTML/
icons). WebSocket (/ws) and file-transfer traffic are never
intercepted or cached. Disabled in dev so it doesn't interfere with
Vite's own HMR websocket.
- Add 512px + maskable 512px icons generated from the existing logo.
- Add iOS "Add to Home Screen" meta tags (manifest support there is
partial).
- Gateway: serve .webmanifest with the correct MIME type.
GitHub Pages only serves static files, but the real app needs a Node gateway and Rust connector to speak the TS3 protocol - neither of which can run there. This adds a fake WebSocket (DemoSocket) that simulates a connection with canned channels/clients entirely client-side, gated behind VITE_DEMO_MODE so the normal Docker build is unaffected, plus a GitHub Actions workflow that builds and publishes it to Pages.
Also fixes a real bug surfaced while testing the disconnect flow: a clean disconnect incorrectly showed "Connection closed before the server responded" because the socket's onclose handler couldn't tell a clean disconnect apart from one that never connected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>