Add app version management, update checks, and periodic SW updates
- Introduced version.json and appVersionAssetPlugin for build-time version tracking. - Enhanced settings page with update check/status UI. - Refactored bootstrap to handle SW updates and initiate periodic checks.
This commit is contained in:
@@ -3,7 +3,6 @@ const APP_SHELL = ['/', '/index.html', '/manifest.webmanifest', '/offline.html',
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(APP_SHELL)));
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (event) => {
|
||||
@@ -19,6 +18,12 @@ self.addEventListener('activate', (event) => {
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event?.data?.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting();
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
if (event.request.method !== 'GET') {
|
||||
return;
|
||||
@@ -40,6 +45,11 @@ self.addEventListener('fetch', (event) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestUrl.pathname === '/version.json') {
|
||||
event.respondWith(fetch(event.request, { cache: 'no-store' }));
|
||||
return;
|
||||
}
|
||||
|
||||
const destination = event.request.destination;
|
||||
if (
|
||||
destination === 'script' ||
|
||||
|
||||
Reference in New Issue
Block a user