skip redundant audio caching in service worker, drop static ip hint
Hunter
Sunday, October 25th, 2026 at 6:46 PM
194 static_files.append(f"mix/{path.name}")
195
196 static_files_js = json.dumps(static_files)
197 + audio_pattern = "|".join(sorted(ext[1:] for ext in AUDIO_EXTS))
198
199 # Generate service-worker.js
200 service_worker_content = f'''// Auto-generated service worker for {app_name} PWA
210
211 // Static files to cache on install
212 const STATIC_FILES = {static_files_js};
213 +const AUDIO_FILE = /\\.({audio_pattern})$/i;
214
215 // Install event - cache static resources only if not already cached.
216 // This makes installs immutable: once a file is in the cache, redeploys
306 return networkResponse;
307 }}
308
309 + if (AUDIO_FILE.test(new URL(event.request.url).pathname)) {{
310 + return networkResponse;
311 + }}
312 +
313 // Clone and cache for future offline use
314 const responseToCache = networkResponse.clone();
315 caches.open(CACHE_NAME)
122
123 3. scan the second QR code to open your mixapp over HTTPS, then follow the <a href="https://hunterirving.github.io/web_workshop/pages/pwa">PWA installation instructions</a> for your device/OS to add it to your homescreen. after the initial installation and cache, mixapps work completely offline; they no longer need the network, server, or certificate.
124
-> **hint:** consider reserving a static IP for your computer in your router's DHCP settings. the cached certificate is tied to your LAN IP, so it breaks if that IP changes (delete `.https_certs/` to re-mint).
-
125 <h3 id="cleaning-up">cleaning up</h3>
126
127 - **on the installing device (recommended):** it's good practice to untrust the CA once you're done installing, and only re-enable it when you want to install another mixapp.