]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - middlewares/reqValidators/remote.js
4 var checkErrors
= require('./utils').checkErrors
5 var logger
= require('../../src/logger')
9 remote
.secureRequest = function (req
, res
, next
) {
10 req
.checkBody('signature.url', 'Should have a signature url').isURL()
11 req
.checkBody('signature.signature', 'Should have a signature').notEmpty()
12 req
.checkBody('key', 'Should have a key').notEmpty()
13 req
.checkBody('data', 'Should have data').notEmpty()
15 logger
.debug('Checking secureRequest parameters', { parameters: req
.body
})
17 checkErrors(req
, res
, next
)
20 remote
.remoteVideosAdd = function (req
, res
, next
) {
21 req
.checkBody('data.name', 'Should have a name').isLength(1, 50)
22 req
.checkBody('data.description', 'Should have a description').isLength(1, 250)
23 req
.checkBody('data.magnetUri', 'Should have a magnetUri').notEmpty()
24 req
.checkBody('data.podUrl', 'Should have a podUrl').isURL()
26 logger
.debug('Checking remoteVideosAdd parameters', { parameters: req
.body
})
28 checkErrors(req
, res
, next
)
31 remote
.remoteVideosRemove = function (req
, res
, next
) {
32 req
.checkBody('data.magnetUri', 'Should have a magnetUri').notEmpty()
34 logger
.debug('Checking remoteVideosRemove parameters', { parameters: req
.body
})
36 checkErrors(req
, res
, next
)
39 module
.exports
= remote