Themes: reintroduce check for defaultBackgroundID: make sure it _does_ exist as global layer

This commit is contained in:
Pieter Vander Vennet 2025-04-17 02:33:49 +02:00
parent fffc959c0d
commit 6a1c5fec97
2 changed files with 5 additions and 8 deletions

View file

@ -58,7 +58,6 @@
"ko": "감시 카메라 및 기타 감시 수단" "ko": "감시 카메라 및 기타 감시 수단"
}, },
"icon": "./assets/themes/surveillance/logo.svg", "icon": "./assets/themes/surveillance/logo.svg",
"defaultBackgroundId": "maptiler.carto",
"layers": [ "layers": [
"surveillance_camera", "surveillance_camera",
{ {

View file

@ -149,16 +149,14 @@ export class ValidateTheme extends DesugaringStep<ThemeConfigJson> {
} }
if (json.defaultBackgroundId) { if (json.defaultBackgroundId) {
/*
TODO re-enable this check
const backgroundId = json.defaultBackgroundId const backgroundId = json.defaultBackgroundId
const isCategory = const isCategory =
backgroundId === "photo" || backgroundId === "map" || backgroundId === "osmbasedmap" backgroundId === "photo" || backgroundId === "map" || backgroundId === "osmbasedmap"
if (!isCategory && !ValidateTheme._availableLayers.has(backgroundId)) { const knownIds = Array.from(AvailableRasterLayers.allAvailableGlobalLayers).map(l => l.properties.id)
const options = Array.from(ValidateTheme._availableLayers) const available = new Set(knownIds)
const nearby = Utils.sortedByLevenshteinDistance(backgroundId, options, (t) => t) if (!isCategory && !available.has(backgroundId)) {
const nearby = Utils.sortedByLevenshteinDistance(backgroundId, knownIds, (t) => t)
context context
.enter("defaultBackgroundId") .enter("defaultBackgroundId")
.err( .err(
@ -166,7 +164,7 @@ export class ValidateTheme extends DesugaringStep<ThemeConfigJson> {
.slice(0, 5) .slice(0, 5)
.join(", ")}`, .join(", ")}`,
) )
}*/ }
} }
for (let i = 0; i < theme.layers.length; i++) { for (let i = 0; i < theme.layers.length; i++) {