From 1e07a88aedb4ed96d47ba3a61daf42029ca773e2 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 3 Sep 2018 21:02:38 +0100 Subject: [PATCH] Updated regex to tilehosting.com, partial revert of #367 --- src/libs/style.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libs/style.js b/src/libs/style.js index a38fa7d..d5aa175 100644 --- a/src/libs/style.js +++ b/src/libs/style.js @@ -92,9 +92,6 @@ function replaceSourceAccessToken(mapStyle, sourceName, opts={}) { ...mapStyle, sources: changedSources } - if (mapStyle.glyphs) { - changedStyle.glyphs = changedStyle.glyphs.replace('{key}', accessToken) - } return changedStyle } @@ -105,6 +102,13 @@ function replaceAccessTokens(mapStyle, opts={}) { changedStyle = replaceSourceAccessToken(changedStyle, sourceName, opts); }) + if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) { + changedStyle = { + ...changedStyle, + glyphs: mapStyle.glyphs.replace('{key}', getAccessToken("openmaptiles", mapStyle, opts)) + } + } + return changedStyle }