diff options
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 4e441fe5f..11b085b78 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -27,14 +27,29 @@ function isVideoCategoryValid (value: number) { | |||
27 | return VIDEO_CATEGORIES[value] !== undefined | 27 | return VIDEO_CATEGORIES[value] !== undefined |
28 | } | 28 | } |
29 | 29 | ||
30 | // Maybe we don't know the remote category, but that doesn't matter | ||
31 | function isRemoteVideoCategoryValid (value: string) { | ||
32 | return validator.isInt('' + value) | ||
33 | } | ||
34 | |||
30 | function isVideoLicenceValid (value: number) { | 35 | function isVideoLicenceValid (value: number) { |
31 | return VIDEO_LICENCES[value] !== undefined | 36 | return VIDEO_LICENCES[value] !== undefined |
32 | } | 37 | } |
33 | 38 | ||
39 | // Maybe we don't know the remote licence, but that doesn't matter | ||
40 | function isRemoteVideoLicenceValid (value: string) { | ||
41 | return validator.isInt('' + value) | ||
42 | } | ||
43 | |||
34 | function isVideoLanguageValid (value: number) { | 44 | function isVideoLanguageValid (value: number) { |
35 | return value === null || VIDEO_LANGUAGES[value] !== undefined | 45 | return value === null || VIDEO_LANGUAGES[value] !== undefined |
36 | } | 46 | } |
37 | 47 | ||
48 | // Maybe we don't know the remote language, but that doesn't matter | ||
49 | function isRemoteVideoLanguageValid (value: string) { | ||
50 | return validator.isInt('' + value) | ||
51 | } | ||
52 | |||
38 | function isVideoNSFWValid (value: any) { | 53 | function isVideoNSFWValid (value: any) { |
39 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) | 54 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) |
40 | } | 55 | } |
@@ -176,5 +191,8 @@ export { | |||
176 | isVideoEventCountValid, | 191 | isVideoEventCountValid, |
177 | isVideoFileSizeValid, | 192 | isVideoFileSizeValid, |
178 | isVideoFileResolutionValid, | 193 | isVideoFileResolutionValid, |
179 | checkVideoExists | 194 | checkVideoExists, |
195 | isRemoteVideoCategoryValid, | ||
196 | isRemoteVideoLicenceValid, | ||
197 | isRemoteVideoLanguageValid | ||
180 | } | 198 | } |