mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 09:16:05 +02:00
perf: move out nconf.get and isClientScript regex
This commit is contained in:
@@ -10,6 +10,9 @@ const activitypub = require('../activitypub');
|
|||||||
const middleware = require('../middleware');
|
const middleware = require('../middleware');
|
||||||
const helpers = require('../middleware/helpers');
|
const helpers = require('../middleware/helpers');
|
||||||
|
|
||||||
|
const relativePath = nconf.get('relative_path');
|
||||||
|
const isClientScript = new RegExp(`^${relativePath}\\/assets\\/src\\/.+\\.js(\\?v=\\w+)?$`);
|
||||||
|
|
||||||
const error404Icons = [
|
const error404Icons = [
|
||||||
'fa-hippo', 'fa-cat', 'fa-otter',
|
'fa-hippo', 'fa-cat', 'fa-otter',
|
||||||
'fa-dog', 'fa-cow', 'fa-fish',
|
'fa-dog', 'fa-cow', 'fa-fish',
|
||||||
@@ -17,9 +20,6 @@ const error404Icons = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
exports.handle404 = helpers.try(async (req, res) => {
|
exports.handle404 = helpers.try(async (req, res) => {
|
||||||
const relativePath = nconf.get('relative_path');
|
|
||||||
const isClientScript = new RegExp(`^${relativePath}\\/assets\\/src\\/.+\\.js(\\?v=\\w+)?$`);
|
|
||||||
|
|
||||||
if (plugins.hooks.hasListeners('action:meta.override404')) {
|
if (plugins.hooks.hasListeners('action:meta.override404')) {
|
||||||
return plugins.hooks.fire('action:meta.override404', {
|
return plugins.hooks.fire('action:meta.override404', {
|
||||||
req: req,
|
req: req,
|
||||||
|
|||||||
Reference in New Issue
Block a user