/** * The map hosts and defaults the client and the server must agree on. * * A GL map reads its style and its tiles through fetch, so every host it may * draw from has to be in the server's Content-Security-Policy connect-src, and * the client may only ask a GL renderer for what that policy allows. Both sides * read the hosts from here, so the policy and the renderer choice cannot drift * apart. Entries are host names in the grammar of map-connect-hosts.ts (https * implied); the server prefixes the scheme. */ /** OpenFreeMap: the styles, vector tiles, sprites and glyphs of the default basemap. */ export const OPENFREEMAP_HOST = 'tiles.openfreemap.org'; /** The style a MapLibre map draws when nobody chose one. */ export const OPENFREEMAP_DEFAULT_STYLE = `https://${OPENFREEMAP_HOST}/styles/liberty`; /** * Values of the `maplibre_style` setting that name no style document. No row * held either before they were introduced, so neither changes what a saved * setting meant, and a client that does not know them reads them as a foreign * style and draws the default. */ /** MapLibre draws the user's map template (`map_tile_url`), the one Leaflet draws. */ export const MAPLIBRE_FROM_TEMPLATE = 'trek:template'; /** MapLibre draws OpenFreeMap Liberty in the light theme and OpenFreeMap Dark in the dark one. */ export const MAPLIBRE_OFM_AUTO = 'trek:ofm-auto'; /** * The raster tile hosts TREK ships, in the order the policy lists them. * * Leaflet loads a tile as an image, which img-src allows from every https host, * so a host missing here still drew there. A GL map and the offline prefetch * fetch the tile instead, and both are refused without the host in connect-src. */ export const RASTER_TILE_HOSTS: readonly string[] = [ // Both forms: CARTO documents the apex host on its key page, so that is the // template users paste in, and the {s} sharded form is what TREK ships (#2054). 'basemaps.cartocdn.com', '*.basemaps.cartocdn.com', // Both forms: a CSP wildcard host never matches the apex, and OSM serves // everything from the bare tile.openstreetmap.org since it retired the // a/b/c/d shards (#1733). The sharded hosts stay listed for tile templates // users saved before that. 'tile.openstreetmap.org', '*.tile.openstreetmap.org', // The other two raster presets. `mode: 'no-cors'` relaxes CORS, not CSP, so // without these the tile prefetch is refused in the document and never // reaches the Service Worker that would cache it (#2180). 'tile.openstreetmap.de', 'tiles.stadiamaps.com', // OpenTopoMap, the key-free raster layer of the Tours planner. Leaflet uses its // a/b/c shards; the apex is named too so a future unsharded template does not // repeat the OSM gap above. 'tile.opentopomap.org', '*.tile.opentopomap.org', // The imagery host. The satellite view worked on Leaflet with this host missing, // while a GL map and the prefetch were refused and no tile ever arrived (#2307). 'server.arcgisonline.com', // OpenSeaMap's transparent seamark layer, offered only to a paddle tour (PAD-10). 'tiles.openseamap.org', // OpenSnowMap's transparent piste layer (SKI-01). 'tiles.opensnowmap.org', // OpenHikingMap, the hiking base map of the Tours planner (MAP-01). 'tile.openmaps.fr', // CyclOSM, the cycling base map of a bike tour (BIK-06); its three shards are // named, so no wildcard opens the whole domain. 'a.tile-cyclosm.openstreetmap.fr', 'b.tile-cyclosm.openstreetmap.fr', 'c.tile-cyclosm.openstreetmap.fr', // Amap's raster tiles, for an install whose users are in China. Road // (webrd01..04) and satellite (webst01..04) are numbered shards of one // domain, so the wildcard is the whole list. '*.is.autonavi.com', ];