Cache radar tile images with a Service Worker
public/sw.js: network-falling-back-to-cache for RainViewer radar tile requests specifically (nothing else — the app itself is served by the same local server that's already the offline resource in the van, so there's no app-shell to precache). Registered from layout.erb, a no-op where it can't register (insecure context) rather than an error. Verified: registers and controls the page, tiles get cached on a normal fetch, cache.match() correctly retrieves them by the same request. CDP's network-blocking simulation doesn't interact cleanly with Service Worker fetch interception (a known tooling quirk, not specific to this), so the actual offline fallback path is the standard try/catch pattern, verified by code review rather than a simulated-offline screenshot.
This commit is contained in:
1 parent
a98b8dbd47
commit
5caf865fc8
3 files changed
+74
-1
No files matched your search
@@ -16,7 +16,7 @@ independence from connectivity.
|
||||
* [ ] Import Park4Night / iOverlander / Freecampsites data
|
||||
* [ ] Kiwix/ZIM offline Wikipedia linked to POI GPS coordinates
|
||||
* [x] Cache weather forecast when temporarily connected — Open-Meteo 3-day forecast in the Radar flyout, last successful fetch cached in localStorage as a fallback when offline
|
||||
** [ ] Cache the radar tile *images* too, not just the forecast text — needs a Service Worker (own bigger task: registration, cache strategy, invalidation); app has HTTPS everywhere (reverse proxy, incl. the in-van local server) so it's viable, just not done yet
|
||||
** [x] Cache the radar tile *images* too — `public/sw.js`, network-falling-back-to-cache for RainViewer tile requests, registered from layout.erb
|
||||
|
||||
== NPS visual style
|
||||
|
||||
|
||||
Reference in new issue
Block a user