aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/remote
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/remote')
-rw-r--r--server/helpers/custom-validators/remote/videos.ts19
1 files changed, 14 insertions, 5 deletions
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 {
23 isVideoNSFWValid, 23 isVideoNSFWValid,
24 isVideoDescriptionValid, 24 isVideoDescriptionValid,
25 isVideoDurationValid, 25 isVideoDurationValid,
26 isVideoInfoHashValid, 26 isVideoFileInfoHashValid,
27 isVideoNameValid, 27 isVideoNameValid,
28 isVideoTagsValid, 28 isVideoTagsValid,
29 isVideoExtnameValid 29 isVideoFileExtnameValid,
30 isVideoFileResolutionValid
30} from '../videos' 31} from '../videos'
31 32
32const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] 33const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS]
@@ -121,14 +122,22 @@ function isCommonVideoAttributesValid (video: any) {
121 isVideoNSFWValid(video.nsfw) && 122 isVideoNSFWValid(video.nsfw) &&
122 isVideoDescriptionValid(video.description) && 123 isVideoDescriptionValid(video.description) &&
123 isVideoDurationValid(video.duration) && 124 isVideoDurationValid(video.duration) &&
124 isVideoInfoHashValid(video.infoHash) &&
125 isVideoNameValid(video.name) && 125 isVideoNameValid(video.name) &&
126 isVideoTagsValid(video.tags) && 126 isVideoTagsValid(video.tags) &&
127 isVideoUUIDValid(video.uuid) && 127 isVideoUUIDValid(video.uuid) &&
128 isVideoExtnameValid(video.extname) &&
129 isVideoViewsValid(video.views) && 128 isVideoViewsValid(video.views) &&
130 isVideoLikesValid(video.likes) && 129 isVideoLikesValid(video.likes) &&
131 isVideoDislikesValid(video.dislikes) 130 isVideoDislikesValid(video.dislikes) &&
131 isArray(video.files) &&
132 video.files.every(videoFile => {
133 if (!videoFile) return false
134
135 return (
136 isVideoFileInfoHashValid(videoFile.infoHash) &&
137 isVideoFileExtnameValid(videoFile.extname) &&
138 isVideoFileResolutionValid(videoFile.resolution)
139 )
140 })
132} 141}
133 142
134function isRequestTypeAddValid (value: string) { 143function isRequestTypeAddValid (value: string) {