mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-01 01:03:16 +01:00
Add backwards compability for tilehosting URLs
This commit is contained in:
parent
cb3f93c67d
commit
fb7b30c81d
2 changed files with 3 additions and 2 deletions
|
@ -50,9 +50,10 @@ function normalizeSourceURL (url, apiToken="") {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFetchAccessToken(url, mapStyle) {
|
function setFetchAccessToken(url, mapStyle) {
|
||||||
|
const matchesTilehosting = url.match(/\.tilehosting\.com/);
|
||||||
const matchesMaptiler = url.match(/\.maptiler\.com/);
|
const matchesMaptiler = url.match(/\.maptiler\.com/);
|
||||||
const matchesThunderforest = url.match(/\.thunderforest\.com/);
|
const matchesThunderforest = url.match(/\.thunderforest\.com/);
|
||||||
if (matchesMaptiler) {
|
if (matchesTilehosting || matchesMaptiler) {
|
||||||
const accessToken = style.getAccessToken("openmaptiles", mapStyle, {allowFallback: true})
|
const accessToken = style.getAccessToken("openmaptiles", mapStyle, {allowFallback: true})
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
return url.replace('{key}', accessToken)
|
return url.replace('{key}', accessToken)
|
||||||
|
|
|
@ -101,7 +101,7 @@ function replaceAccessTokens(mapStyle, opts={}) {
|
||||||
changedStyle = replaceSourceAccessToken(changedStyle, sourceName, 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);
|
const newAccessToken = getAccessToken("openmaptiles", mapStyle, opts);
|
||||||
if (newAccessToken) {
|
if (newAccessToken) {
|
||||||
changedStyle = {
|
changedStyle = {
|
||||||
|
|
Loading…
Reference in a new issue