feat: SW update banner — notify instead of force-reload
- SW activate now posts SW_UPDATED message to all clients instead of calling client.navigate() (which was disruptive and unreliable) - injectPWA() calls reg.update() on every app open to eagerly check for a new SW rather than waiting for the 24h browser interval - showUpdateBanner() renders a persistent accent-bordered toast with version tag, a "Neu laden" button and a dismiss X - Banner sits above player bar, repositions on mobile above bottom-nav Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
15959b45eb
commit
e462b54adf
3 files changed
+63
-6
No files matched your search
@@ -1,4 +1,4 @@
|
||||
const CACHE = 'ns-v27';
|
||||
const CACHE = 'ns-v28';
|
||||
const PRECACHE = ['/', 'index.html', 'styles.css', 'app.js', 'manifest.json', 'icon.svg'];
|
||||
const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js'];
|
||||
|
||||
@@ -12,8 +12,8 @@ self.addEventListener('activate', e => {
|
||||
caches.keys()
|
||||
.then(keys => Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k))))
|
||||
.then(() => self.clients.claim())
|
||||
.then(() => self.clients.matchAll({type: 'window', includeUncontrolled: true}))
|
||||
.then(clients => clients.forEach(c => c.navigate(c.url)))
|
||||
.then(() => self.clients.matchAll({ type: 'window', includeUncontrolled: true }))
|
||||
.then(clients => clients.forEach(c => c.postMessage({ type: 'SW_UPDATED', version: CACHE })))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user