]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/themes.ts
Implemented configurable minimum signup age
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / themes.ts
index 24a9673f788d5c08194a3cecf81e518b5d77626a..a726a567bdadbd75bd261796d47a793c63a8c289 100644 (file)
@@ -5,6 +5,7 @@ import { areValidationErrors } from './utils'
 import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
 import { isSafePath } from '../../helpers/custom-validators/misc'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
 const serveThemeCSSValidator = [
   param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'),
@@ -16,14 +17,14 @@ const serveThemeCSSValidator = [
 
     if (areValidationErrors(req, res)) return
 
-    const theme = PluginManager.Instance.getRegisteredTheme(req.params.themeName)
+    const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)
 
     if (!theme || theme.version !== req.params.themeVersion) {
-      return res.sendStatus(404)
+      return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
     }
 
     if (theme.css.includes(req.params.staticEndpoint) === false) {
-      return res.sendStatus(404)
+      return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
     }
 
     res.locals.registeredPlugin = theme