aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/themes.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/themes.ts')
-rw-r--r--server/middlewares/validators/themes.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/themes.ts b/server/middlewares/validators/themes.ts
index 82794656d..a726a567b 100644
--- a/server/middlewares/validators/themes.ts
+++ b/server/middlewares/validators/themes.ts
@@ -5,6 +5,7 @@ import { areValidationErrors } from './utils'
5import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' 5import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
6import { PluginManager } from '../../lib/plugins/plugin-manager' 6import { PluginManager } from '../../lib/plugins/plugin-manager'
7import { isSafePath } from '../../helpers/custom-validators/misc' 7import { isSafePath } from '../../helpers/custom-validators/misc'
8import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
8 9
9const serveThemeCSSValidator = [ 10const serveThemeCSSValidator = [
10 param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'), 11 param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'),
@@ -19,11 +20,11 @@ const serveThemeCSSValidator = [
19 const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName) 20 const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)
20 21
21 if (!theme || theme.version !== req.params.themeVersion) { 22 if (!theme || theme.version !== req.params.themeVersion) {
22 return res.sendStatus(404) 23 return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
23 } 24 }
24 25
25 if (theme.css.includes(req.params.staticEndpoint) === false) { 26 if (theme.css.includes(req.params.staticEndpoint) === false) {
26 return res.sendStatus(404) 27 return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
27 } 28 }
28 29
29 res.locals.registeredPlugin = theme 30 res.locals.registeredPlugin = theme