]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - middlewares/reqValidators/remote.js
4 var checkErrors
= require('./utils').checkErrors
5 var logger
= require('../../helpers/logger')
7 var reqValidatorsRemote
= {
8 remoteVideosAdd: remoteVideosAdd
,
9 remoteVideosRemove: remoteVideosRemove
,
10 secureRequest: secureRequest
13 function remoteVideosAdd (req
, res
, next
) {
14 req
.checkBody('data').isArray()
15 req
.checkBody('data').eachIsRemoteVideosAddValid()
17 logger
.debug('Checking remoteVideosAdd parameters', { parameters: req
.body
})
19 checkErrors(req
, res
, next
)
22 function remoteVideosRemove (req
, res
, next
) {
23 req
.checkBody('data').isArray()
24 req
.checkBody('data').eachIsRemoteVideosRemoveValid()
26 logger
.debug('Checking remoteVideosRemove parameters', { parameters: req
.body
})
28 checkErrors(req
, res
, next
)
31 function secureRequest (req
, res
, next
) {
32 req
.checkBody('signature.url', 'Should have a signature url').isURL()
33 req
.checkBody('signature.signature', 'Should have a signature').notEmpty()
34 req
.checkBody('key', 'Should have a key').notEmpty()
35 req
.checkBody('data', 'Should have data').notEmpty()
37 logger
.debug('Checking secureRequest parameters', { parameters: { data: req
.body
.data
, keyLength: req
.body
.key
.length
} })
39 checkErrors(req
, res
, next
)
42 // ---------------------------------------------------------------------------
44 module
.exports
= reqValidatorsRemote