diff --git a/app/static/sw.js b/app/static/sw.js index 4b4e58d..fe576ab 100644 --- a/app/static/sw.js +++ b/app/static/sw.js @@ -1,9 +1,28 @@ // NextSnap Service Worker // Provides offline-first caching for the app shell -const CACHE_VERSION = 'nextsnap-v19'; -const APP_SHELL_CACHE = 'nextsnap-shell-v15'; -const RUNTIME_CACHE = 'nextsnap-runtime-v15'; +const CACHE_VERSION = 'nextsnap-v20'; +const APP_SHELL_CACHE = 'nextsnap-shell-v16'; +const RUNTIME_CACHE = 'nextsnap-runtime-v16'; + +// Offline fallback page (served when network fails and no cached version exists) +const OFFLINE_PAGE = ` + + +Offline - NextSnap + +

You're Offline

Check your internet connection and try again.

+
+`; // Assets to cache on install const APP_SHELL_ASSETS = [ @@ -128,7 +147,10 @@ self.addEventListener('fetch', (event) => { { status: 503, headers: { 'Content-Type': 'application/json' } } ); } - return new Response('Offline', { status: 503 }); + return new Response(OFFLINE_PAGE, { + status: 200, + headers: { 'Content-Type': 'text/html' } + }); }); }) );