]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/reqValidators/remote.js
3 const checkErrors
= require('./utils').checkErrors
4 const logger
= require('../../helpers/logger')
6 const reqValidatorsRemote
= {
7 dataToDecrypt: dataToDecrypt
,
8 remoteVideos: remoteVideos
,
12 function dataToDecrypt (req
, res
, next
) {
13 req
.checkBody('key', 'Should have a key').notEmpty()
14 req
.checkBody('data', 'Should have data').notEmpty()
16 logger
.debug('Checking dataToDecrypt parameters', { parameters: { keyLength: req
.body
.key
.length
, bodyLength: req
.body
.data
.length
} })
18 checkErrors(req
, res
, next
)
21 function remoteVideos (req
, res
, next
) {
22 req
.checkBody('data').isArray()
23 req
.checkBody('data').isEachRemoteVideosValid()
25 logger
.debug('Checking remoteVideos parameters', { parameters: req
.body
})
27 checkErrors(req
, res
, next
)
30 function signature (req
, res
, next
) {
31 req
.checkBody('signature.url', 'Should have a signature url').isURL()
32 req
.checkBody('signature.signature', 'Should have a signature').notEmpty()
34 logger
.debug('Checking signature parameters', { parameters: { signatureUrl: req
.body
.signature
.url
} })
36 checkErrors(req
, res
, next
)
39 // ---------------------------------------------------------------------------
41 module
.exports
= reqValidatorsRemote