aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/videos/videos.ts21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 44233b653..5f1234379 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -496,6 +496,14 @@ const commonVideosFiltersValidator = [
496 .optional() 496 .optional()
497 .customSanitizer(toBooleanOrNull) 497 .customSanitizer(toBooleanOrNull)
498 .custom(isBooleanValid).withMessage('Should have a valid local boolean'), 498 .custom(isBooleanValid).withMessage('Should have a valid local boolean'),
499 query('hasHLSFiles')
500 .optional()
501 .customSanitizer(toBooleanOrNull)
502 .custom(isBooleanValid).withMessage('Should have a valid has hls boolean'),
503 query('hasWebtorrentFiles')
504 .optional()
505 .customSanitizer(toBooleanOrNull)
506 .custom(isBooleanValid).withMessage('Should have a valid has webtorrent boolean'),
499 query('skipCount') 507 query('skipCount')
500 .optional() 508 .optional()
501 .customSanitizer(toBooleanOrNull) 509 .customSanitizer(toBooleanOrNull)
@@ -525,12 +533,13 @@ const commonVideosFiltersValidator = [
525 533
526 const user = res.locals.oauth?.token.User 534 const user = res.locals.oauth?.token.User
527 535
528 if (req.query.include && (!user || user.hasRight(UserRight.SEE_ALL_VIDEOS) !== true)) { 536 if ((!user || user.hasRight(UserRight.SEE_ALL_VIDEOS) !== true)) {
529 res.fail({ 537 if (req.query.include) {
530 status: HttpStatusCode.UNAUTHORIZED_401, 538 return res.fail({
531 message: 'You are not allowed to see all local videos.' 539 status: HttpStatusCode.UNAUTHORIZED_401,
532 }) 540 message: 'You are not allowed to see all videos.'
533 return 541 })
542 }
534 } 543 }
535 544
536 return next() 545 return next()