From 51c443dbe0284c5ec54033be06f554ec37397bce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Oct 2017 10:40:37 +0200 Subject: Be tolerant with remote requests Just remove videos we don't want --- server/helpers/custom-validators/videos.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'server/helpers/custom-validators/videos.ts') 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) { return VIDEO_CATEGORIES[value] !== undefined } +// Maybe we don't know the remote category, but that doesn't matter +function isRemoteVideoCategoryValid (value: string) { + return validator.isInt('' + value) +} + function isVideoLicenceValid (value: number) { return VIDEO_LICENCES[value] !== undefined } +// Maybe we don't know the remote licence, but that doesn't matter +function isRemoteVideoLicenceValid (value: string) { + return validator.isInt('' + value) +} + function isVideoLanguageValid (value: number) { return value === null || VIDEO_LANGUAGES[value] !== undefined } +// Maybe we don't know the remote language, but that doesn't matter +function isRemoteVideoLanguageValid (value: string) { + return validator.isInt('' + value) +} + function isVideoNSFWValid (value: any) { return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) } @@ -176,5 +191,8 @@ export { isVideoEventCountValid, isVideoFileSizeValid, isVideoFileResolutionValid, - checkVideoExists + checkVideoExists, + isRemoteVideoCategoryValid, + isRemoteVideoLicenceValid, + isRemoteVideoLanguageValid } -- cgit v1.2.3