fix: move call to `filter:middleware.buildHeader` out of parallel so that req can be overridden by plugins prior to loading config

isekai-main
Julian Lam 2 years ago
parent 66b41d6763
commit 0a691e6744

@ -34,10 +34,11 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
if (req.method === 'GET') {
await require('./index').applyCSRFasync(req, res);
}
({ req, locals: res.locals } = await plugins.hooks.fire('filter:middleware.buildHeader', { req: req, locals: res.locals }));
const [config, canLoginIfBanned] = await Promise.all([
controllers.api.loadConfig(req),
user.bans.canLoginIfBanned(req.uid),
plugins.hooks.fire('filter:middleware.buildHeader', { req: req, locals: res.locals }),
]);
if (!canLoginIfBanned && req.loggedIn) {

Loading…
Cancel
Save