aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos.ts')
-rw-r--r--server/middlewares/validators/videos.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts
index bffc50322..e8cb2ae03 100644
--- a/server/middlewares/validators/videos.ts
+++ b/server/middlewares/validators/videos.ts
@@ -2,10 +2,10 @@ import * as express from 'express'
2import 'express-validator' 2import 'express-validator'
3import { body, param, query } from 'express-validator/check' 3import { body, param, query } from 'express-validator/check'
4import { UserRight, VideoPrivacy } from '../../../shared' 4import { UserRight, VideoPrivacy } from '../../../shared'
5import { isIdOrUUIDValid, isIdValid } from '../../helpers/custom-validators/misc' 5import { isBooleanValid, isIdOrUUIDValid, isIdValid } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isVideoAbuseReasonValid, isVideoCategoryValid, isVideoDescriptionValid, isVideoExist, isVideoFile, isVideoLanguageValid, 7 isVideoAbuseReasonValid, isVideoCategoryValid, isVideoDescriptionValid, isVideoExist, isVideoFile, isVideoLanguageValid,
8 isVideoLicenceValid, isVideoNameValid, isVideoNSFWValid, isVideoPrivacyValid, isVideoRatingTypeValid, isVideoTagsValid 8 isVideoLicenceValid, isVideoNameValid, isVideoPrivacyValid, isVideoRatingTypeValid, isVideoTagsValid
9} from '../../helpers/custom-validators/videos' 9} from '../../helpers/custom-validators/videos'
10import { getDurationFromVideoFile } from '../../helpers/ffmpeg-utils' 10import { getDurationFromVideoFile } from '../../helpers/ffmpeg-utils'
11import { logger } from '../../helpers/logger' 11import { logger } from '../../helpers/logger'
@@ -26,11 +26,12 @@ const videosAddValidator = [
26 body('category').optional().custom(isVideoCategoryValid).withMessage('Should have a valid category'), 26 body('category').optional().custom(isVideoCategoryValid).withMessage('Should have a valid category'),
27 body('licence').optional().custom(isVideoLicenceValid).withMessage('Should have a valid licence'), 27 body('licence').optional().custom(isVideoLicenceValid).withMessage('Should have a valid licence'),
28 body('language').optional().custom(isVideoLanguageValid).withMessage('Should have a valid language'), 28 body('language').optional().custom(isVideoLanguageValid).withMessage('Should have a valid language'),
29 body('nsfw').custom(isVideoNSFWValid).withMessage('Should have a valid NSFW attribute'), 29 body('nsfw').custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
30 body('description').optional().custom(isVideoDescriptionValid).withMessage('Should have a valid description'), 30 body('description').optional().custom(isVideoDescriptionValid).withMessage('Should have a valid description'),
31 body('channelId').custom(isIdValid).withMessage('Should have correct video channel id'), 31 body('channelId').custom(isIdValid).withMessage('Should have correct video channel id'),
32 body('privacy').custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'), 32 body('privacy').custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'),
33 body('tags').optional().custom(isVideoTagsValid).withMessage('Should have correct tags'), 33 body('tags').optional().custom(isVideoTagsValid).withMessage('Should have correct tags'),
34 body('commentsEnabled').custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
34 35
35 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 36 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
36 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files }) 37 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
@@ -85,10 +86,11 @@ const videosUpdateValidator = [
85 body('category').optional().custom(isVideoCategoryValid).withMessage('Should have a valid category'), 86 body('category').optional().custom(isVideoCategoryValid).withMessage('Should have a valid category'),
86 body('licence').optional().custom(isVideoLicenceValid).withMessage('Should have a valid licence'), 87 body('licence').optional().custom(isVideoLicenceValid).withMessage('Should have a valid licence'),
87 body('language').optional().custom(isVideoLanguageValid).withMessage('Should have a valid language'), 88 body('language').optional().custom(isVideoLanguageValid).withMessage('Should have a valid language'),
88 body('nsfw').optional().custom(isVideoNSFWValid).withMessage('Should have a valid NSFW attribute'), 89 body('nsfw').optional().custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
89 body('privacy').optional().custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'), 90 body('privacy').optional().custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'),
90 body('description').optional().custom(isVideoDescriptionValid).withMessage('Should have a valid description'), 91 body('description').optional().custom(isVideoDescriptionValid).withMessage('Should have a valid description'),
91 body('tags').optional().custom(isVideoTagsValid).withMessage('Should have correct tags'), 92 body('tags').optional().custom(isVideoTagsValid).withMessage('Should have correct tags'),
93 body('commentsEnabled').optional().custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
92 94
93 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 95 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
94 logger.debug('Checking videosUpdate parameters', { parameters: req.body }) 96 logger.debug('Checking videosUpdate parameters', { parameters: req.body })