diff --git a/CHANGELOG.md b/CHANGELOG.md index 1caaa3d2..e42cbaab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### New features TBD ### Bug fixes -TBD +- PWA: Removed the custom offline page in favour of browser default ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/607)) ### Tweaks TBD ### Lang diff --git a/app/frontend/static/assets/js/shared/service-worker.js b/app/frontend/static/assets/js/shared/service-worker.js index f8073c39..2fdbf708 100644 --- a/app/frontend/static/assets/js/shared/service-worker.js +++ b/app/frontend/static/assets/js/shared/service-worker.js @@ -1,6 +1,8 @@ // This is the "Offline page" service worker -importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'); +importScripts( + "https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js" +); const CACHE = "crafty-controller"; @@ -8,39 +10,32 @@ const CACHE = "crafty-controller"; const offlineFallbackPage = "/offline"; self.addEventListener("message", (event) => { - if (event.data && event.data.type === "SKIP_WAITING") { - self.skipWaiting(); - } -}); - -self.addEventListener('install', async (event) => { - event.waitUntil( - caches.open(CACHE) - .then((cache) => cache.add(offlineFallbackPage)) - ); + if (event.data && event.data.type === "SKIP_WAITING") { + self.skipWaiting(); + } }); if (workbox.navigationPreload.isSupported()) { - workbox.navigationPreload.enable(); + workbox.navigationPreload.enable(); } -self.addEventListener('fetch', (event) => { - if (event.request.mode === 'navigate') { - event.respondWith((async () => { - try { - const preloadResp = await event.preloadResponse; +// self.addEventListener('fetch', (event) => { +// if (event.request.mode === 'navigate') { +// event.respondWith((async () => { +// try { +// const preloadResp = await event.preloadResponse; - if (preloadResp) { - return preloadResp; - } - const networkResp = await fetch(event.request); - return networkResp; - } catch (error) { +// if (preloadResp) { +// return preloadResp; +// } +// const networkResp = await fetch(event.request); +// return networkResp; +// } catch (error) { - const cache = await caches.open(CACHE); - const cachedResp = await cache.match(offlineFallbackPage); - return cachedResp; - } - })()); - } -}); \ No newline at end of file +// const cache = await caches.open(CACHE); +// const cachedResp = await cache.match(offlineFallbackPage); +// return cachedResp; +// } +// })()); +// } +// }); diff --git a/app/frontend/templates/panel/denied.html b/app/frontend/templates/panel/denied.html index d4548c05..7107db16 100644 --- a/app/frontend/templates/panel/denied.html +++ b/app/frontend/templates/panel/denied.html @@ -1,106 +1,103 @@ + + + + + Crafty Controller + + + + + + - - - - - Crafty Controller - - - - - - + + + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - -
-
-
-
-
- -
-
-

-
-