diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-10 11:46:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-10 11:46:50 +0200 |
commit | 1cd3facc3de899ac864e979cd6d6a704b712cce3 (patch) | |
tree | 7a781918d6bf1426ec76cc18390922f65971a278 /server/helpers/custom-validators | |
parent | b014b6b9c7cb68d09c52b44046afe486c0736426 (diff) | |
download | PeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.tar.gz PeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.tar.zst PeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.zip |
Add ability to list all local videos
Including private/unlisted for moderators/admins
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 714f7ac95..a13b09ac8 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -3,7 +3,7 @@ import 'express-validator' | |||
3 | import { values } from 'lodash' | 3 | import { values } from 'lodash' |
4 | import 'multer' | 4 | import 'multer' |
5 | import * as validator from 'validator' | 5 | import * as validator from 'validator' |
6 | import { UserRight, VideoPrivacy, VideoRateType } from '../../../shared' | 6 | import { UserRight, VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' |
7 | import { | 7 | import { |
8 | CONSTRAINTS_FIELDS, | 8 | CONSTRAINTS_FIELDS, |
9 | VIDEO_CATEGORIES, | 9 | VIDEO_CATEGORIES, |
@@ -22,6 +22,10 @@ import { fetchVideo, VideoFetchType } from '../video' | |||
22 | 22 | ||
23 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS | 23 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS |
24 | 24 | ||
25 | function isVideoFilterValid (filter: VideoFilter) { | ||
26 | return filter === 'local' || filter === 'all-local' | ||
27 | } | ||
28 | |||
25 | function isVideoCategoryValid (value: any) { | 29 | function isVideoCategoryValid (value: any) { |
26 | return value === null || VIDEO_CATEGORIES[ value ] !== undefined | 30 | return value === null || VIDEO_CATEGORIES[ value ] !== undefined |
27 | } | 31 | } |
@@ -225,5 +229,6 @@ export { | |||
225 | isVideoExist, | 229 | isVideoExist, |
226 | isVideoImage, | 230 | isVideoImage, |
227 | isVideoChannelOfAccountExist, | 231 | isVideoChannelOfAccountExist, |
228 | isVideoSupportValid | 232 | isVideoSupportValid, |
233 | isVideoFilterValid | ||
229 | } | 234 | } |