Do not use locals middleware in named maps controller
This commit is contained in:
parent
f7a23c094c
commit
5fc801f8a6
@ -1,6 +1,5 @@
|
||||
const cors = require('../middleware/cors');
|
||||
const user = require('../middleware/user');
|
||||
const locals = require('../middleware/locals');
|
||||
const cleanUpQueryParams = require('../middleware/clean-up-query-params');
|
||||
const layergroupToken = require('../middleware/layergroup-token');
|
||||
const credentials = require('../middleware/credentials');
|
||||
@ -58,7 +57,6 @@ NamedMapsController.prototype.register = function(app) {
|
||||
`${templateBasePath}/:template_id/:layer/:z/:x/:y.(:format)`,
|
||||
cors(),
|
||||
cleanUpQueryParams(),
|
||||
locals(),
|
||||
user(),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_TILES),
|
||||
layergroupToken(),
|
||||
@ -86,7 +84,6 @@ NamedMapsController.prototype.register = function(app) {
|
||||
`${mapconfigBasePath}/static/named/:template_id/:width/:height.:format`,
|
||||
cors(),
|
||||
cleanUpQueryParams(['layer', 'zoom', 'lon', 'lat', 'bbox']),
|
||||
locals(),
|
||||
user(),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC_NAMED),
|
||||
layergroupToken(),
|
||||
@ -215,9 +212,11 @@ function prepareLayerFilterFromPreviewLayers ({ namedMapProviderCache, label })
|
||||
|
||||
function getTile ({ tileBackend, label }) {
|
||||
return function getTileMiddleware (req, res, next) {
|
||||
const { mapConfigProvider, format } = res.locals;
|
||||
const { mapConfigProvider } = res.locals;
|
||||
const { layer, z, x, y, format } = req.params;
|
||||
const params = { layer, z, x, y, format };
|
||||
|
||||
tileBackend.getTile(mapConfigProvider, req.params, (err, tile, headers, stats) => {
|
||||
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats) => {
|
||||
req.profiler.add(stats);
|
||||
req.profiler.done('render-' + format);
|
||||
|
||||
@ -240,8 +239,10 @@ function getTile ({ tileBackend, label }) {
|
||||
function getStaticImageOptions ({ tablesExtentApi }) {
|
||||
return function getStaticImageOptionsMiddleware(req, res, next) {
|
||||
const { user, mapConfigProvider, template } = res.locals;
|
||||
const { zoom, lon, lat, bbox } = req.query;
|
||||
const params = { zoom, lon, lat, bbox };
|
||||
|
||||
const imageOpts = getImageOptions(res.locals, template);
|
||||
const imageOpts = getImageOptions(params, template);
|
||||
|
||||
if (imageOpts) {
|
||||
res.locals.imageOpts = imageOpts;
|
||||
|
Loading…
Reference in New Issue
Block a user