]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/config.ts
Fix i18n generation
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / config.ts
index 31b1319146b360c36d94e3d1cf9b4779a811f5ad..5059ed0f2994a10ec328b28b77127695f74f9cfc 100644 (file)
@@ -1,11 +1,12 @@
 import * as express from 'express'
-import { body } from 'express-validator/check'
+import { body } from 'express-validator'
 import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
 import { logger } from '../../helpers/logger'
 import { CustomConfig } from '../../../shared/models/server/custom-config.model'
 import { Emailer } from '../../lib/emailer'
 import { areValidationErrors } from './utils'
-import { isThemeValid } from '../../helpers/custom-validators/plugins'
+import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
+import { isThemeRegistered } from '../../lib/plugins/theme-utils'
 
 const customConfigUpdateValidator = [
   body('instance.name').exists().withMessage('Should have a valid instance name'),
@@ -48,7 +49,7 @@ const customConfigUpdateValidator = [
   body('followers.instance.enabled').isBoolean().withMessage('Should have a valid followers of instance boolean'),
   body('followers.instance.manualApproval').isBoolean().withMessage('Should have a valid manual approval boolean'),
 
-  body('theme.default').custom(isThemeValid).withMessage('Should have a valid theme'),
+  body('theme.default').custom(v => isThemeNameValid(v) && isThemeRegistered(v)).withMessage('Should have a valid theme'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
     logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body })