From 8f5be4f7421a1422d6c4c327a4e5ed0d914b2042 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 12 Jun 2024 15:03:10 +0200 Subject: [PATCH] Split summary-server constant --- package.json | 2 ++ src/Models/Constants.ts | 1 + src/Models/ThemeViewState.ts | 3 +-- src/index.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b5020986c..9ef566671 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "url": "https://www.openstreetmap.org" }, "mvt_layer_server": "https://cache.mapcomplete.org/public.{type}_{layer}/{z}/{x}/{y}.pbf", + "#summary_server": "Should be the endpoint; appending status.json should work", + "summary_server": "https://cache.mapcomplete.org/", "disabled:oauth_credentials": { "##": "DEV", "#": "This client-id is registered by 'MapComplete' on https://master.apis.dev.openstreetmap.org/", diff --git a/src/Models/Constants.ts b/src/Models/Constants.ts index d13b6f75d..4f9894c40 100644 --- a/src/Models/Constants.ts +++ b/src/Models/Constants.ts @@ -164,6 +164,7 @@ export default class Constants { */ public static VectorTileServer: string | undefined = Constants.config.mvt_layer_server public static readonly maptilerApiKey = "GvoVAJgu46I5rZapJuAy" + public static readonly SummaryServer: string = Constants.config.summary_server private static isRetina(): boolean { if (Utils.runningFromConsole) { diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index 9ae12e26c..d76c84318 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -690,9 +690,8 @@ export default class ThemeViewState implements SpecialVisualizationState { l.source.geojsonSource === undefined && l.doCount ) - const url = new URL(Constants.VectorTileServer) const summaryTileSource = new SummaryTileSource( - url.protocol + "//" + url.host + "/summary", + Constants.SummaryServer, layers.map((l) => l.id), this.mapProperties.zoom.map((z) => Math.max(Math.floor(z), 0)), this.mapProperties, diff --git a/src/index.ts b/src/index.ts index 2d5a1a03a..10e28cc55 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,7 @@ async function timeout(timeMS: number): Promise<{ layers: string[] }> { async function getAvailableLayers(): Promise> { try { - const host = new URL(Constants.VectorTileServer).host + const host = new URL(Constants.SummaryServer).host const status: { layers: string[] } = await Promise.any([ Utils.downloadJson<{layers}>("https://" + host + "/summary/status.json"), timeout(2500),