mirror of
https://github.com/narrrl/pl8list-rewind.git
synced 2026-11-03 16:41:26 +01:00
The raised icon was cut into a mesh too coarse for its edges and did not line up with the icon painted over it, so it came out doubled and jagged, and melting one shape into the other went through blobby in-betweens. The icon is now only painted: crisp and white on a dark disc like the page's round buttons, still turning with the drop, and pause and play fade into each other as the new one grows in. Some browsers only offer to install an app with a service worker. A minimal one at /sw.js (served from the root so it covers the whole app) caches nothing and only shows a short offline note instead of the browser's error page. The manifest gets an id.
19 lines
981 B
JavaScript
19 lines
981 B
JavaScript
// Makes the app installable from the browser (some browsers want a service worker
|
|
// for that) and shows a short note instead of the browser's error page when the
|
|
// phone is offline. Nothing is cached: audio, artwork and the feed always come
|
|
// from the network, and every other request passes straight through.
|
|
|
|
self.addEventListener("install", () => self.skipWaiting());
|
|
self.addEventListener("activate", (e) => e.waitUntil(self.clients.claim()));
|
|
|
|
const OFFLINE = `<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"><title>pl8list ∞</title></head>
|
|
<body bgcolor="#000000" text="#f2f2f2"><p>You are offline. pl8list ∞ needs a connection to play.</p></body></html>`;
|
|
|
|
self.addEventListener("fetch", (e) => {
|
|
if (e.request.mode !== "navigate") return;
|
|
e.respondWith(
|
|
fetch(e.request).catch(() => new Response(OFFLINE, { headers: { "Content-Type": "text/html; charset=utf-8" } })),
|
|
);
|
|
});
|