From da5f5b622c48b1ba2d34fe17c924c8456850bc3c Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 8 Jan 2022 13:04:11 +0100 Subject: [PATCH] Allow non-conforming ids for unofficial themes --- Models/Constants.ts | 2 +- Models/ThemeConfig/LayoutConfig.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Models/Constants.ts b/Models/Constants.ts index eaa6c0eab..56c1f1285 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import {Utils} from "../Utils"; export default class Constants { - public static vNumber = "0.13.0"; + public static vNumber = "0.13.1"; public static ImgurApiKey = '7070e7167f0a25a' public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85" diff --git a/Models/ThemeConfig/LayoutConfig.ts b/Models/ThemeConfig/LayoutConfig.ts index e18cd7d8f..e09ef2186 100644 --- a/Models/ThemeConfig/LayoutConfig.ts +++ b/Models/ThemeConfig/LayoutConfig.ts @@ -7,6 +7,8 @@ import {LayerConfigJson} from "./Json/LayerConfigJson"; import Constants from "../Constants"; import TilesourceConfig from "./TilesourceConfig"; import DependencyCalculator from "./DependencyCalculator"; +import {DomEvent} from "leaflet"; +import off = DomEvent.off; export default class LayoutConfig { public readonly id: string; @@ -58,11 +60,13 @@ export default class LayoutConfig { constructor(json: LayoutConfigJson, official = true, context?: string) { this.official = official; this.id = json.id; - if(json.id.toLowerCase() !== json.id){ - throw "The id of a theme should be lowercase: "+json.id - } - if(json.id.match(/[a-z0-9-_]/) == null){ - throw "The id of a theme should match [a-z0-9-_]*: "+json.id + if(official){ + if(json.id.toLowerCase() !== json.id){ + throw "The id of a theme should be lowercase: "+json.id + } + if(json.id.match(/[a-z0-9-_]/) == null){ + throw "The id of a theme should match [a-z0-9-_]*: "+json.id + } } context = (context ?? "") + "." + this.id; this.maintainer = json.maintainer;