Remove obsolete old code

This commit is contained in:
Petr Sloup
2019-12-30 17:00:23 +01:00
parent cdc7803ad8
commit 515c295898
3 changed files with 3 additions and 41 deletions

View File

@@ -64,14 +64,11 @@ module.exports = (options, repo, params, id, publicUrl, reportTiles, reportFont)
repo[id] = styleJSON;
app.get(`/${id}/style.json`, (req, res, next) => {
const fixUrl = (url, opt_nokey, opt_nostyle) => {
const fixUrl = (url, opt_nokey) => {
if (!url || (typeof url !== 'string') || url.indexOf('local://') !== 0) {
return url;
}
const queryParams = [];
if (!opt_nostyle && global.addStyleParam) {
queryParams.push(`style=${id}`);
}
if (!opt_nokey && req.query.key) {
queryParams.unshift(`key=${req.query.key}`);
}
@@ -90,10 +87,10 @@ module.exports = (options, repo, params, id, publicUrl, reportTiles, reportFont)
}
// mapbox-gl-js viewer cannot handle sprite urls with query
if (styleJSON_.sprite) {
styleJSON_.sprite = fixUrl(styleJSON_.sprite, true, true);
styleJSON_.sprite = fixUrl(styleJSON_.sprite, true);
}
if (styleJSON_.glyphs) {
styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false, true);
styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false);
}
return res.send(styleJSON_);
});