feat(pwa): service worker for installability + offline app shell#716
Open
shuff57 wants to merge 1 commit into
Open
feat(pwa): service worker for installability + offline app shell#716shuff57 wants to merge 1 commit into
shuff57 wants to merge 1 commit into
Conversation
Listenarr already ships a web manifest; add vite-plugin-pwa to register a service worker so it's installable (Add to Home Screen / desktop Install) and loads offline. Reuses the existing site.webmanifest (manifest:false). The API, plugin assets, hubs, and swagger are denylisted from the navigation fallback and never cached. Service workers only activate on a secure context (HTTPS/localhost), so plain-HTTP deployments are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Turns Listenarr into an installable PWA with an offline app shell, by adding a service worker via
vite-plugin-pwa. The web manifest already exists (site.webmanifest) — this fills in the missing half.manifest: false) — no duplicate manifest, no icon changes.registerType: 'autoUpdate'; the API, plugin assets, hubs, and swagger are on the navigateFallback denylist and are never cached (navigateFallbackDenylist: [/^\/api/, /^\/plugins/, /^\/hubs/, /^\/swagger/]), so no stale data or intercepted API calls.No-op unless secure
Service workers only run on a secure context (HTTPS or
localhost). On a plain-HTTP LAN deployment the browser simply doesn't register it — behaviour is unchanged. So this is purely additive for HTTPS/reverse-proxy setups and inert otherwise.Diff
The meaningful change is 17 lines — the
VitePWA({...})block invite.config.ts+ one devDependency. The largepackage-lock.jsondiff isvite-plugin-pwa's transitive tree (Workbox + Babel for SW generation); regenerate with your npm if the churn is noisy.Testing
vite buildproducesdist/sw.js+registerSW.jsand precaches the shell (~98 entries). Verified the build on Vite 8; the registration script is injected intoindex.html.