]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/themes.ts
Add ability to install alpha/beta/rc plugin
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / themes.ts
index 7b9fee85884c69615c38e3594867b74bef83b579..080b3e096303fc12c8d2c73e0039b8465063eac2 100644 (file)
@@ -2,19 +2,19 @@ import express from 'express'
 import { param } from 'express-validator'
 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 { isPluginNameValid, isPluginStableOrUnstableVersionValid } from '../../helpers/custom-validators/plugins'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
 import { areValidationErrors } from './shared'
 
 const serveThemeCSSValidator = [
-  param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'),
-  param('themeVersion').custom(isPluginVersionValid).withMessage('Should have a valid theme version'),
-  param('staticEndpoint').custom(isSafePath).withMessage('Should have a valid static endpoint'),
+  param('themeName')
+    .custom(isPluginNameValid),
+  param('themeVersion')
+    .custom(isPluginStableOrUnstableVersionValid),
+  param('staticEndpoint')
+    .custom(isSafePath),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking serveThemeCSS parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)