aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/reqValidators/remote.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-18 16:13:54 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-18 16:13:54 +0200
commit528a9efa8272532bbd0dafc35c3e05e57c50f61e (patch)
tree62d4417df4ab9b2e53c44dc7271be81b88e4e0e5 /server/middlewares/reqValidators/remote.js
parentb2e4c0ba1a33b8a50491a1f8d111468a7da5640f (diff)
downloadPeerTube-528a9efa8272532bbd0dafc35c3e05e57c50f61e.tar.gz
PeerTube-528a9efa8272532bbd0dafc35c3e05e57c50f61e.tar.zst
PeerTube-528a9efa8272532bbd0dafc35c3e05e57c50f61e.zip
Try to make a better communication (between pods) module
Diffstat (limited to 'server/middlewares/reqValidators/remote.js')
-rw-r--r--server/middlewares/reqValidators/remote.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/server/middlewares/reqValidators/remote.js b/server/middlewares/reqValidators/remote.js
index b5f3118b0..a23673d89 100644
--- a/server/middlewares/reqValidators/remote.js
+++ b/server/middlewares/reqValidators/remote.js
@@ -4,36 +4,34 @@ const checkErrors = require('./utils').checkErrors
4const logger = require('../../helpers/logger') 4const logger = require('../../helpers/logger')
5 5
6const reqValidatorsRemote = { 6const reqValidatorsRemote = {
7 remoteVideosAdd: remoteVideosAdd, 7 dataToDecrypt: dataToDecrypt,
8 remoteVideosRemove: remoteVideosRemove, 8 remoteVideos: remoteVideos,
9 secureRequest: secureRequest 9 signature: signature
10} 10}
11 11
12function remoteVideosAdd (req, res, next) { 12function dataToDecrypt (req, res, next) {
13 req.checkBody('data').isArray() 13 req.checkBody('key', 'Should have a key').notEmpty()
14 req.checkBody('data').isEachAddRemoteVideosValid() 14 req.checkBody('data', 'Should have data').notEmpty()
15 15
16 logger.debug('Checking remoteVideosAdd parameters', { parameters: req.body }) 16 logger.debug('Checking dataToDecrypt parameters', { parameters: { keyLength: req.body.key.length, bodyLength: req.body.data.length } })
17 17
18 checkErrors(req, res, next) 18 checkErrors(req, res, next)
19} 19}
20 20
21function remoteVideosRemove (req, res, next) { 21function remoteVideos (req, res, next) {
22 req.checkBody('data').isArray() 22 req.checkBody('data').isArray()
23 req.checkBody('data').isEachRemoveRemoteVideosValid() 23 req.checkBody('data').isEachRemoteVideosValid()
24 24
25 logger.debug('Checking remoteVideosRemove parameters', { parameters: req.body }) 25 logger.debug('Checking remoteVideosAdd parameters', { parameters: req.body })
26 26
27 checkErrors(req, res, next) 27 checkErrors(req, res, next)
28} 28}
29 29
30function secureRequest (req, res, next) { 30function signature (req, res, next) {
31 req.checkBody('signature.url', 'Should have a signature url').isURL() 31 req.checkBody('signature.url', 'Should have a signature url').isURL()
32 req.checkBody('signature.signature', 'Should have a signature').notEmpty() 32 req.checkBody('signature.signature', 'Should have a signature').notEmpty()
33 req.checkBody('key', 'Should have a key').notEmpty()
34 req.checkBody('data', 'Should have data').notEmpty()
35 33
36 logger.debug('Checking secureRequest parameters', { parameters: { data: req.body.data, keyLength: req.body.key.length } }) 34 logger.debug('Checking signature parameters', { parameters: { signatureUrl: req.body.signature.url } })
37 35
38 checkErrors(req, res, next) 36 checkErrors(req, res, next)
39} 37}