mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
feat: response:router.page, dep. filter variant
This commit is contained in:
@@ -82,13 +82,20 @@ middleware.pageView = function pageView(req, res, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
middleware.pluginHooks = function pluginHooks(req, res, next) {
|
middleware.pluginHooks = async function pluginHooks(req, res, next) {
|
||||||
async.each(plugins.loadedHooks['filter:router.page'] || [], function (hookObj, next) {
|
// TODO: Deprecate in v2.0
|
||||||
|
await async.each(plugins.loadedHooks['filter:router.page'] || [], function (hookObj, next) {
|
||||||
hookObj.method(req, res, next);
|
hookObj.method(req, res, next);
|
||||||
}, function (err) {
|
|
||||||
// If it got here, then none of the subscribed hooks did anything, or there were no hooks
|
|
||||||
next(err);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await plugins.fireHook('response:router.page', {
|
||||||
|
req: req,
|
||||||
|
res: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.headersSent) {
|
||||||
|
next();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
middleware.validateFiles = function validateFiles(req, res, next) {
|
middleware.validateFiles = function validateFiles(req, res, next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user