fix: allow tile size to be set at json endpoints
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
24f6a833ec
commit
a7dc8f38a3
3 changed files with 6 additions and 6 deletions
|
|
@ -168,8 +168,8 @@ export const serve_data = {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get('/:id.json', (req, res, next) => {
|
app.get('/(:tileSize(256|512)/)?:id.json', (req, res, next) => {
|
||||||
const tileSize = undefined;
|
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
||||||
const item = repo[req.params.id];
|
const item = repo[req.params.id];
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
|
|
|
||||||
|
|
@ -822,8 +822,8 @@ export const serve_rendered = {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/:id.json', (req, res, next) => {
|
app.get('/(:tileSize(256|512)/)?:id.json', (req, res, next) => {
|
||||||
const tileSize = 512;
|
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
||||||
const item = repo[req.params.id];
|
const item = repo[req.params.id];
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ export const getTileUrls = (
|
||||||
format = aliases[format];
|
format = aliases[format];
|
||||||
}
|
}
|
||||||
|
|
||||||
let tileParams = '{z}/{x}/{y}';
|
let tileParams = `{z}/{x}/{y}`;
|
||||||
if (tileSize && ['png', 'jpg', 'jpeg', 'webp'].includes(format)) {
|
if (tileSize && ['png', 'jpg', 'jpeg', 'webp'].includes(format)) {
|
||||||
tileParams = '{tileSize}/{z}/{x}/{y}';
|
tileParams = `${tileSize}/{z}/{x}/{y}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uris = [];
|
const uris = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue