From bf03a15337b8617a0ac1713b50908a66085d0359 Mon Sep 17 00:00:00 2001 From: Bobban Rydh Date: Sat, 26 Sep 2026 02:07:04 +0200 Subject: [PATCH] Make the app installable as a PWA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a web manifest, icons (standard 192/512, a full-bleed maskable 512 with the glyph kept inside the safe zone, and an iOS touch icon), theme-color/apple meta tags, and a service worker, so "Install app" / "Add to Home Screen" gives it its own icon and a standalone window. The service worker is a deliberate no-cache pass-through: it registers a fetch listener (so browsers treat the app as installable) but never calls respondWith(), so every request goes to the network exactly as without a worker. A caching worker would keep serving an old JS bundle after each rebuild — the same stale-build confusion that already cost time on the settings layout fix — and this app is a live view of authenticated data with no useful offline mode. Registered in production builds only. Icons are generated procedurally (server-rack glyph on the sidebar's dark colour) and encoded as real PNGs; visually checked, including that the maskable variant keeps the glyph inside the safe zone. Verified in a real Chromium (headless Edge) over the DevTools protocol against the built bundle served with the same express.static setup as production: the DevTools installability audit reported no errors, the manifest parsed with no errors, the worker registered at scope "/", activated and took control, and a navigation through the worker returned the app page normally. The manifest is served as application/manifest+json and sw.js as JavaScript. The in-app preview pane silently blocks service-worker script fetches, so it could not be used for this — hence the real browser. Real dev database mtime untouched throughout. Co-Authored-By: Claude Sonnet 5 --- README.md | 6 ++++++ web/index.html | 7 +++++++ web/public/apple-touch-icon.png | Bin 0 -> 797 bytes web/public/icon-192.png | Bin 0 -> 1744 bytes web/public/icon-512.png | Bin 0 -> 5751 bytes web/public/icon-maskable-512.png | Bin 0 -> 3825 bytes web/public/manifest.webmanifest | 16 ++++++++++++++++ web/public/sw.js | 8 ++++++++ web/src/main.tsx | 9 +++++++++ 9 files changed, 46 insertions(+) create mode 100644 web/public/apple-touch-icon.png create mode 100644 web/public/icon-192.png create mode 100644 web/public/icon-512.png create mode 100644 web/public/icon-maskable-512.png create mode 100644 web/public/manifest.webmanifest create mode 100644 web/public/sw.js diff --git a/README.md b/README.md index 328e407..2670842 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,12 @@ real API response (fixed to derive them from `connectedToControl` and `enabledRoutes`). See the git log for the full verification notes per integration. +The app is installable as a PWA — "Install app" / "Add to Home Screen" from the +browser gives it its own icon and a standalone window on phone or desktop. This +needs the site to be served over HTTPS (browsers only offer install on secure +origins; `localhost` also counts). The bundled service worker deliberately +caches nothing, so an installed copy always shows the current build. + ## Requirements - Node.js 20+ diff --git a/web/index.html b/web/index.html index 60151f2..4d45d67 100644 --- a/web/index.html +++ b/web/index.html @@ -4,6 +4,13 @@ Homelab Manager + + + + + + +