1// Minimal service worker: exists to make the app installable as a PWA. 2// v2 â intercepts as little as possible. 3// 4// IMPORTANT: only plain same-origin GET subresources are handled. POSTs 5// (sign-in/sign-up form submissions!), navigations, and cross-origin 6// requests pass through to the network untouched â naively wrapping those 7// in respondWith(fetch(...)) broke Chrome's auth redirect flow. 8// 9// Deliberately NO caching: the station is a live synchronized broadcast; 10// stale responses would break the "everyone sees the same TV" promise. 11self.addEventListener("install", () => { 12 self.skipWaiting(); 13}); 14 15self.addEventListener("activate", (event) => { 16 event.waitUntil(self.clients.claim()); 17}); 18 19self.addEventListener("fetch", (event) => { 20 const req = event.request; 21 if (req.method !== "GET") return; 22 if (req.mode === "navigate") return; 23 let sameOrigin = false; 24 try { 25 sameOrigin = new URL(req.url).origin === self.location.origin; 26 } catch { 27 return; 28 } 29 if (!sameOrigin) return; 30 31 event.respondWith( 32 fetch(req).catch( 33 () => new Response("", { status: 504, statusText: "Offline" }), 34 ), 35 ); 36});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.