Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(pwa): cache Amap tiles like the other raster presets

Mauricef120266f9efe
diff --git a/client/vite.config.js b/client/vite.config.js
index c20f0e2e9..ded3c086d 100644
--- a/client/vite.config.js
+++ b/client/vite.config.js
@@ -126,6 +126,18 @@ export default defineConfig(({ mode }) => ({
cacheableResponse: { statuses: [0, 200] },
},
},
+ {
+ // Amap road and satellite presets, served from the shard hosts under
+ // is.autonavi.com (src/constants/mapDefaults.ts). Without a rule here
+ // they would be the #2180 hole all over again.
+ urlPattern: /^https:\/\/(?:[a-z0-9]+\.)?is\.autonavi\.com\/.*/i,
+ handler: 'CacheFirst',
+ options: {
+ cacheName: 'map-tiles',
+ expiration: { maxEntries: 12288, maxAgeSeconds: 30 * 24 * 60 * 60 },
+ cacheableResponse: { statuses: [0, 200] },
+ },
+ },
{
// The GL style DOCUMENT, for both providers. It has to be matched
// before the tile rules below, because Workbox takes the first route