diff --git a/service-worker.js b/service-worker.js index a22bba96..3919c39d 100644 --- a/service-worker.js +++ b/service-worker.js @@ -1,48 +1,56 @@ -const staticDevCoffee = 'wishthis' -const assets = [ - '/src/assets/css/default/dark.css', + +const service_worker = 'wishthis'; +const assets = [ '/src/assets/css/blog.css', '/src/assets/css/default.css', '/src/assets/css/home.css', + '/src/assets/css/install.css', '/src/assets/css/post.css', + '/src/assets/css/wish.css', '/src/assets/css/wishlists-saved.css', '/src/assets/css/wishlists.css', - - '/src/assets/img/favicon/android-chrome-192x192.png', - '/src/assets/img/favicon/android-chrome-512x512.png', - '/src/assets/img/favicon/apple-touch-icon.png', - '/src/assets/img/favicon/favicon-16x16.png', - '/src/assets/img/favicon/favicon-32x32.png', - '/src/assets/img/favicon/favicon.ico', - '/src/assets/img/favicon/mstile-70x70.png', - '/src/assets/img/favicon/mstile-150x150.png', - '/src/assets/img/favicon/mstile-310x150.png', + '/src/assets/css/default/dark.css', '/src/assets/img/favicon.png', '/src/assets/img/favicon.svg', '/src/assets/img/logo-animation.svg', + '/src/assets/img/logo-readme.svg', '/src/assets/img/logo-square-white-background.png', '/src/assets/img/logo-square-white-background.svg', '/src/assets/img/logo-square.png', '/src/assets/img/logo-square.svg', '/src/assets/img/logo.svg', '/src/assets/img/no-image.svg', - - '/src/assets/js/parts/wishlist-filter.js', + '/src/assets/img/favicon/android-chrome-192x192.png', + '/src/assets/img/favicon/android-chrome-512x512.png', + '/src/assets/img/favicon/apple-touch-icon.png', + '/src/assets/img/favicon/browserconfig.xml', + '/src/assets/img/favicon/favicon-16x16.png', + '/src/assets/img/favicon/favicon-32x32.png', + '/src/assets/img/favicon/favicon.ico', + '/src/assets/img/favicon/mstile-144x144.png', + '/src/assets/img/favicon/mstile-150x150.png', + '/src/assets/img/favicon/mstile-310x150.png', + '/src/assets/img/favicon/mstile-310x310.png', + '/src/assets/img/favicon/mstile-70x70.png', + '/src/assets/img/favicon/safari-pinned-tab.svg', '/src/assets/js/changelog.js', '/src/assets/js/default.js', '/src/assets/js/home.js', + '/src/assets/js/html2canvas.js', + '/src/assets/js/install.js', '/src/assets/js/login-as.js', + '/src/assets/js/login.js', '/src/assets/js/profile.js', '/src/assets/js/register.js', - '/src/assets/js/service-worker.js', '/src/assets/js/wishlist.js', - '/src/assets/js/wishlists.js', -] + '/src/assets/js/parts/wishlist-filter.js', + '/src/assets/js/parts/wishlists.js', + ]; self.addEventListener('install', installEvent => { installEvent.waitUntil( - caches.open(staticDevCoffee).then(cache => { - cache.addAll(assets) + caches.open(service_worker).then(cache => { + cache.addAll(assets); }) ) }) @@ -50,7 +58,8 @@ self.addEventListener('install', installEvent => { self.addEventListener('fetch', fetchEvent => { fetchEvent.respondWith( caches.match(fetchEvent.request).then(res => { - return res || fetch(fetchEvent.request) + return res || fetch(fetchEvent.request); }) ) }) + diff --git a/src/assets/js/service-worker.js.php b/src/assets/js/service-worker.js.php new file mode 100644 index 00000000..51c89a10 --- /dev/null +++ b/src/assets/js/service-worker.js.php @@ -0,0 +1,84 @@ + + +const service_worker = 'wishthis'; +const assets = [ + +]; + +self.addEventListener('install', installEvent => { + installEvent.waitUntil( + caches.open(service_worker).then(cache => { + cache.addAll(assets); + }) + ) +}) + +self.addEventListener('fetch', fetchEvent => { + fetchEvent.respondWith( + caches.match(fetchEvent.request).then(res => { + return res || fetch(fetchEvent.request); + }) + ) +}) + +setOption('version', VERSION); $options->setOption('updateAvailable', false); + /** Update service-worker.js */ + require ROOT . '/src/assets/js/service-worker.js.php'; + $page->messages[] = Page::success( sprintf( __('Database successfully migrated to %s.'),