diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-02 15:34:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-06 11:19:16 +0200 |
commit | fbad87b0472f574409f7aa3ae7f8b54927d0cdd6 (patch) | |
tree | 197b4209e75d57dabae7cdd6f2da5f765e427023 /server/middlewares/validators/videos.ts | |
parent | 5e319fb7898fd0482c399cc3ae9dcfc20d274a58 (diff) | |
download | PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.tar.gz PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.tar.zst PeerTube-fbad87b0472f574409f7aa3ae7f8b54927d0cdd6.zip |
Add ability to import video with youtube-dl
Diffstat (limited to 'server/middlewares/validators/videos.ts')
-rw-r--r-- | server/middlewares/validators/videos.ts | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 9357c1e39..c812d4677 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -223,36 +223,6 @@ const videosShareValidator = [ | |||
223 | } | 223 | } |
224 | ] | 224 | ] |
225 | 225 | ||
226 | // --------------------------------------------------------------------------- | ||
227 | |||
228 | export { | ||
229 | videosAddValidator, | ||
230 | videosUpdateValidator, | ||
231 | videosGetValidator, | ||
232 | videosRemoveValidator, | ||
233 | videosShareValidator, | ||
234 | |||
235 | videoAbuseReportValidator, | ||
236 | |||
237 | videoRateValidator | ||
238 | } | ||
239 | |||
240 | // --------------------------------------------------------------------------- | ||
241 | |||
242 | function areErrorsInScheduleUpdate (req: express.Request, res: express.Response) { | ||
243 | if (req.body.scheduleUpdate) { | ||
244 | if (!req.body.scheduleUpdate.updateAt) { | ||
245 | res.status(400) | ||
246 | .json({ error: 'Schedule update at is mandatory.' }) | ||
247 | .end() | ||
248 | |||
249 | return true | ||
250 | } | ||
251 | } | ||
252 | |||
253 | return false | ||
254 | } | ||
255 | |||
256 | function getCommonVideoAttributes () { | 226 | function getCommonVideoAttributes () { |
257 | return [ | 227 | return [ |
258 | body('thumbnailfile') | 228 | body('thumbnailfile') |
@@ -319,3 +289,35 @@ function getCommonVideoAttributes () { | |||
319 | .custom(isScheduleVideoUpdatePrivacyValid).withMessage('Should have correct schedule update privacy') | 289 | .custom(isScheduleVideoUpdatePrivacyValid).withMessage('Should have correct schedule update privacy') |
320 | ] as (ValidationChain | express.Handler)[] | 290 | ] as (ValidationChain | express.Handler)[] |
321 | } | 291 | } |
292 | |||
293 | // --------------------------------------------------------------------------- | ||
294 | |||
295 | export { | ||
296 | videosAddValidator, | ||
297 | videosUpdateValidator, | ||
298 | videosGetValidator, | ||
299 | videosRemoveValidator, | ||
300 | videosShareValidator, | ||
301 | |||
302 | videoAbuseReportValidator, | ||
303 | |||
304 | videoRateValidator, | ||
305 | |||
306 | getCommonVideoAttributes | ||
307 | } | ||
308 | |||
309 | // --------------------------------------------------------------------------- | ||
310 | |||
311 | function areErrorsInScheduleUpdate (req: express.Request, res: express.Response) { | ||
312 | if (req.body.scheduleUpdate) { | ||
313 | if (!req.body.scheduleUpdate.updateAt) { | ||
314 | res.status(400) | ||
315 | .json({ error: 'Schedule update at is mandatory.' }) | ||
316 | .end() | ||
317 | |||
318 | return true | ||
319 | } | ||
320 | } | ||
321 | |||
322 | return false | ||
323 | } | ||