comparison mrjunejune/src/sw.js @ 259:667156fcd3e3

Add dev-only cyberpunk JRPG page
author MrJuneJune <me@mrjunejune.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents 60a876c4587a
children 1f9877b637e9
comparison
equal deleted inserted replaced
258:60a876c4587a 259:667156fcd3e3
1 // Root-scoped Service Worker for MrJuneJune PWA 1 // Root-scoped Service Worker for MrJuneJune PWA
2 const CACHE_VERSION = 'v6-zenbu-headless'; 2 const CACHE_VERSION = 'v9-dev-page-split';
3 const CACHE_NAME = `mrjunejune-${CACHE_VERSION}`; 3 const CACHE_NAME = `mrjunejune-${CACHE_VERSION}`;
4 4
5 // Files to cache immediately on install 5 // Files to cache immediately on install
6 const STATIC_CACHE = [ 6 const STATIC_CACHE = [
7 '/', 7 '/',
91 // Skip API calls and media uploads (always go to network) 91 // Skip API calls and media uploads (always go to network)
92 if (url.pathname.startsWith('/api/')) { 92 if (url.pathname.startsWith('/api/')) {
93 return; 93 return;
94 } 94 }
95 95
96 // Development servers should always serve current source and assets.
97 if (url.hostname === 'localhost' || url.hostname === '127.0.0.1') {
98 return;
99 }
100
96 // The HLS tool and media must always reflect the current player version. 101 // The HLS tool and media must always reflect the current player version.
97 if (url.pathname.startsWith('/tools/hls_player') || 102 if (url.pathname.startsWith('/tools/hls_player') ||
98 url.pathname.startsWith('/public/hls-sample/')) { 103 url.pathname.startsWith('/public/hls-sample/')) {
99 return; 104 return;
100 } 105 }