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.defaultOverpassUrls,
Constants.countryCoderEndpoint, Constants.countryCoderEndpoint,
Constants.nominatimEndpoint, Constants.nominatimEndpoint,
AvailableRasterLayers.maptilerCarto.properties.url, ...AvailableRasterLayers.vectorLayers.map(l => l.properties.url),
AvailableRasterLayers.maptilerDefaultLayer.properties.url,
"https://api.openstreetmap.org", "https://api.openstreetmap.org",
"https://pietervdvn.goatcounter.com", "https://pietervdvn.goatcounter.com",
] ]

View file

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