mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
d39d544297
Leaflet loads a tile as an image without CORS and the prefetch fetches it no-cors, so map-tiles holds opaque answers. A GL map reads tiles with a CORS fetch and cannot use one: once Leaflet had drawn an OpenTopoMap tile, the GL tour layer failed on the same URL, and a MapLibre template would fail the same way on every prefetched tile. A CORS request for a raster preset's tile now goes to map-tiles-gl, which keeps only readable answers, ahead of the Leaflet rules; images and the no-cors prefetch stay in map-tiles. The matcher is written into the service worker by its source text, so its host list is inline, and a test holds it to the hosts the CSP lets a GL map fetch. OpenHikingMap and CyclOSM stay out, their usage policies allow no offline copy. The prefetch takes exactly one way per user: a template MapLibre draws on such a host is fetched with CORS into map-tiles-gl, at the density the map asks for, everything else as before. Clearing offline maps drops both caches, and the iOS trim keeps both within its budget.