diff options
Diffstat (limited to 'server/middlewares/validators/videos/video-imports.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-imports.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.ts index 9c6d213c4..3115acb21 100644 --- a/server/middlewares/validators/videos/video-imports.ts +++ b/server/middlewares/validators/videos/video-imports.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { body, param } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { isResolvingToUnicastOnly } from '@server/helpers/dns' | 3 | import { isResolvingToUnicastOnly } from '@server/helpers/dns' |
4 | import { isPreImportVideoAccepted } from '@server/lib/moderation' | 4 | import { isPreImportVideoAccepted } from '@server/lib/moderation' |
5 | import { Hooks } from '@server/lib/plugins/hooks' | 5 | import { Hooks } from '@server/lib/plugins/hooks' |
@@ -92,6 +92,20 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([ | |||
92 | } | 92 | } |
93 | ]) | 93 | ]) |
94 | 94 | ||
95 | const getMyVideoImportsValidator = [ | ||
96 | query('videoChannelSyncId') | ||
97 | .optional() | ||
98 | .custom(isIdValid).withMessage('Should have correct videoChannelSync id'), | ||
99 | |||
100 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
101 | logger.debug('Checking getMyVideoImportsValidator parameters', { parameters: req.params }) | ||
102 | |||
103 | if (areValidationErrors(req, res)) return | ||
104 | |||
105 | return next() | ||
106 | } | ||
107 | ] | ||
108 | |||
95 | const videoImportDeleteValidator = [ | 109 | const videoImportDeleteValidator = [ |
96 | param('id') | 110 | param('id') |
97 | .custom(isIdValid).withMessage('Should have correct import id'), | 111 | .custom(isIdValid).withMessage('Should have correct import id'), |
@@ -143,7 +157,8 @@ const videoImportCancelValidator = [ | |||
143 | export { | 157 | export { |
144 | videoImportAddValidator, | 158 | videoImportAddValidator, |
145 | videoImportCancelValidator, | 159 | videoImportCancelValidator, |
146 | videoImportDeleteValidator | 160 | videoImportDeleteValidator, |
161 | getMyVideoImportsValidator | ||
147 | } | 162 | } |
148 | 163 | ||
149 | // --------------------------------------------------------------------------- | 164 | // --------------------------------------------------------------------------- |