From fb7b30c81d83e83971a927bb6f5f0557f9d19cb3 Mon Sep 17 00:00:00 2001 From: pathmapper Date: Sat, 6 Apr 2019 12:00:48 +0200 Subject: [PATCH] Add backwards compability for tilehosting URLs --- src/components/App.jsx | 3 ++- src/libs/style.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index 9dd3a5a..34216c8 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -50,9 +50,10 @@ function normalizeSourceURL (url, apiToken="") { } function setFetchAccessToken(url, mapStyle) { + const matchesTilehosting = url.match(/\.tilehosting\.com/); const matchesMaptiler = url.match(/\.maptiler\.com/); const matchesThunderforest = url.match(/\.thunderforest\.com/); - if (matchesMaptiler) { + if (matchesTilehosting || matchesMaptiler) { const accessToken = style.getAccessToken("openmaptiles", mapStyle, {allowFallback: true}) if (accessToken) { return url.replace('{key}', accessToken) diff --git a/src/libs/style.js b/src/libs/style.js index 8f90dd6..5f2b494 100644 --- a/src/libs/style.js +++ b/src/libs/style.js @@ -101,7 +101,7 @@ function replaceAccessTokens(mapStyle, opts={}) { changedStyle = replaceSourceAccessToken(changedStyle, sourceName, opts); }) - if (mapStyle.glyphs && mapStyle.glyphs.match(/\.maptiler\.com/)) { + if (mapStyle.glyphs && (mapStyle.glyphs.match(/\.tilehosting\.com/) || mapStyle.glyphs.match(/\.maptiler\.com/))) { const newAccessToken = getAccessToken("openmaptiles", mapStyle, opts); if (newAccessToken) { changedStyle = {