-import * as express from 'express'
+import express from 'express'
import { param } from 'express-validator'
-import { logger } from '../../helpers/logger'
-import { areValidationErrors } from './utils'
+import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
+import { isSafePath } from '../../helpers/custom-validators/misc'
import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
+import { logger } from '../../helpers/logger'
import { PluginManager } from '../../lib/plugins/plugin-manager'
-import { isSafePath } from '../../helpers/custom-validators/misc'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
+import { areValidationErrors } from './shared'
const serveThemeCSSValidator = [
param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'),
const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)
if (!theme || theme.version !== req.params.themeVersion) {
- return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
+ return res.fail({
+ status: HttpStatusCode.NOT_FOUND_404,
+ message: 'No theme named ' + req.params.themeName + ' was found with version ' + req.params.themeVersion
+ })
}
if (theme.css.includes(req.params.staticEndpoint) === false) {
- return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
+ return res.fail({
+ status: HttpStatusCode.NOT_FOUND_404,
+ message: 'No static endpoint was found for this theme'
+ })
}
res.locals.registeredPlugin = theme