Fix: add all vector layers to CSP

This commit is contained in:
Pieter Vander Vennet 2023-10-08 14:09:29 +02:00
parent 36a73f3a17
commit 2736740cd0
2 changed files with 8 additions and 9 deletions

View file

@ -245,8 +245,7 @@ function generateCsp(
...Constants.defaultOverpassUrls,
Constants.countryCoderEndpoint,
Constants.nominatimEndpoint,
AvailableRasterLayers.maptilerCarto.properties.url,
AvailableRasterLayers.maptilerDefaultLayer.properties.url,
...AvailableRasterLayers.vectorLayers.map(l => l.properties.url),
"https://api.openstreetmap.org",
"https://pietervdvn.goatcounter.com",
]

View file

@ -100,6 +100,12 @@ export class AvailableRasterLayers {
geometry: BBox.global.asGeometry(),
}
public static readonly vectorLayers = [ AvailableRasterLayers.maptilerDefaultLayer,
AvailableRasterLayers.osmCarto,
AvailableRasterLayers.maptilerCarto,
AvailableRasterLayers.maptilerBackdrop,
AvailableRasterLayers.americana]
public static layersAvailableAt(
location: Store<{ lon: number; lat: number }>
): Store<RasterLayerPolygon[]> {
@ -122,13 +128,7 @@ export class AvailableRasterLayers {
return GeoOperations.inside(lonlat, eliPolygon)
})
matching.push(...AvailableRasterLayers.globalLayers)
matching.unshift(
AvailableRasterLayers.maptilerDefaultLayer,
AvailableRasterLayers.osmCarto,
AvailableRasterLayers.maptilerCarto,
AvailableRasterLayers.maptilerBackdrop,
AvailableRasterLayers.americana
)
matching.unshift(...AvailableRasterLayers.vectorLayers)
return matching
})
)