Server: fix remote videos requests validator
This commit is contained in:
parent
4613274479
commit
6c1a098b41
|
@ -22,26 +22,27 @@ const videosValidators = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEachRemoteVideosValid (requests) {
|
function isEachRemoteVideosValid (requests) {
|
||||||
return requests.every(function (request) {
|
return miscValidators.isArray(requests) &&
|
||||||
const video = request.data
|
requests.every(function (request) {
|
||||||
return (
|
const video = request.data
|
||||||
isRequestTypeAddValid(request.type) &&
|
return (
|
||||||
isVideoAuthorValid(video.author) &&
|
isRequestTypeAddValid(request.type) &&
|
||||||
isVideoDateValid(video.createdDate) &&
|
isVideoAuthorValid(video.author) &&
|
||||||
isVideoDescriptionValid(video.description) &&
|
isVideoDateValid(video.createdDate) &&
|
||||||
isVideoDurationValid(video.duration) &&
|
isVideoDescriptionValid(video.description) &&
|
||||||
isVideoMagnetUriValid(video.magnetUri) &&
|
isVideoDurationValid(video.duration) &&
|
||||||
isVideoNameValid(video.name) &&
|
isVideoMagnetUriValid(video.magnetUri) &&
|
||||||
isVideoPodUrlValid(video.podUrl) &&
|
isVideoNameValid(video.name) &&
|
||||||
isVideoTagsValid(video.tags) &&
|
isVideoPodUrlValid(video.podUrl) &&
|
||||||
isVideoThumbnail64Valid(video.thumbnailBase64)
|
isVideoTagsValid(video.tags) &&
|
||||||
) ||
|
isVideoThumbnail64Valid(video.thumbnailBase64)
|
||||||
(
|
) ||
|
||||||
isRequestTypeRemoveValid(request.type) &&
|
(
|
||||||
isVideoNameValid(video.name) &&
|
isRequestTypeRemoveValid(request.type) &&
|
||||||
isVideoMagnetUriValid(video.magnetUri)
|
isVideoNameValid(video.name) &&
|
||||||
)
|
isVideoMagnetUriValid(video.magnetUri)
|
||||||
})
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function isVideoAuthorValid (value) {
|
function isVideoAuthorValid (value) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ function dataToDecrypt (req, res, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remoteVideos (req, res, next) {
|
function remoteVideos (req, res, next) {
|
||||||
req.checkBody('data').isArray()
|
|
||||||
req.checkBody('data').isEachRemoteVideosValid()
|
req.checkBody('data').isEachRemoteVideosValid()
|
||||||
|
|
||||||
logger.debug('Checking remoteVideos parameters', { parameters: req.body })
|
logger.debug('Checking remoteVideos parameters', { parameters: req.body })
|
||||||
|
|
Loading…
Reference in New Issue