aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r--server/helpers/custom-validators/videos.ts20
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
31function isRemoteVideoCategoryValid (value: string) {
32 return validator.isInt('' + value)
33}
34
30function isVideoLicenceValid (value: number) { 35function 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
40function isRemoteVideoLicenceValid (value: string) {
41 return validator.isInt('' + value)
42}
43
34function isVideoLanguageValid (value: number) { 44function 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
49function isRemoteVideoLanguageValid (value: string) {
50 return validator.isInt('' + value)
51}
52
38function isVideoNSFWValid (value: any) { 53function 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}