From 93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Aug 2017 11:36:23 +0200 Subject: Move video file metadata in their own table Will be used for user video quotas and multiple video resolutions --- server/helpers/custom-validators/remote/videos.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'server/helpers/custom-validators/remote') diff --git a/server/helpers/custom-validators/remote/videos.ts b/server/helpers/custom-validators/remote/videos.ts index b33d8c9be..091cd2186 100644 --- a/server/helpers/custom-validators/remote/videos.ts +++ b/server/helpers/custom-validators/remote/videos.ts @@ -23,10 +23,11 @@ import { isVideoNSFWValid, isVideoDescriptionValid, isVideoDurationValid, - isVideoInfoHashValid, + isVideoFileInfoHashValid, isVideoNameValid, isVideoTagsValid, - isVideoExtnameValid + isVideoFileExtnameValid, + isVideoFileResolutionValid } from '../videos' const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] @@ -121,14 +122,22 @@ function isCommonVideoAttributesValid (video: any) { isVideoNSFWValid(video.nsfw) && isVideoDescriptionValid(video.description) && isVideoDurationValid(video.duration) && - isVideoInfoHashValid(video.infoHash) && isVideoNameValid(video.name) && isVideoTagsValid(video.tags) && isVideoUUIDValid(video.uuid) && - isVideoExtnameValid(video.extname) && isVideoViewsValid(video.views) && isVideoLikesValid(video.likes) && - isVideoDislikesValid(video.dislikes) + isVideoDislikesValid(video.dislikes) && + isArray(video.files) && + video.files.every(videoFile => { + if (!videoFile) return false + + return ( + isVideoFileInfoHashValid(videoFile.infoHash) && + isVideoFileExtnameValid(videoFile.extname) && + isVideoFileResolutionValid(videoFile.resolution) + ) + }) } function isRequestTypeAddValid (value: string) { -- cgit v1.2.3