X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fconfig.ts;h=f3f257d573dbefb87457eefbb80efba0e2d1f8b4;hb=d9eaee3939bf2e93e5d775d32bce77842201faba;hp=800aaf107495acfd6ddae3555fa84a47586a71c3;hpb=fd206f0b2d7e5c8e00e2817266d90ec54f79e1da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index 800aaf107..f3f257d57 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts @@ -1,10 +1,17 @@ import * as express from 'express' import { body } from 'express-validator/check' -import { isUserVideoQuotaValid } from '../../helpers/custom-validators/users' +import { isUserNSFWPolicyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' import { logger } from '../../helpers/logger' import { areValidationErrors } from './utils' const customConfigUpdateValidator = [ + body('instance.name').exists().withMessage('Should have a valid instance name'), + body('instance.description').exists().withMessage('Should have a valid instance description'), + body('instance.terms').exists().withMessage('Should have a valid instance terms'), + body('instance.defaultClientRoute').exists().withMessage('Should have a valid instance default client route'), + body('instance.defaultNSFWPolicy').custom(isUserNSFWPolicyValid).withMessage('Should have a valid NSFW policy'), + body('instance.customizations.css').exists().withMessage('Should have a valid instance CSS customization'), + body('instance.customizations.javascript').exists().withMessage('Should have a valid instance JavaScript customization'), body('cache.previews.size').isInt().withMessage('Should have a valid previews size'), body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'), body('signup.limit').isInt().withMessage('Should have a valid signup limit'), @@ -17,6 +24,8 @@ const customConfigUpdateValidator = [ body('transcoding.resolutions.480p').isBoolean().withMessage('Should have a valid transcoding 480p resolution enabled boolean'), body('transcoding.resolutions.720p').isBoolean().withMessage('Should have a valid transcoding 720p resolution enabled boolean'), body('transcoding.resolutions.1080p').isBoolean().withMessage('Should have a valid transcoding 1080p resolution enabled boolean'), + body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'), + body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body })