diff options
Diffstat (limited to 'server/middlewares/reqValidators')
-rw-r--r-- | server/middlewares/reqValidators/pods.js | 6 | ||||
-rw-r--r-- | server/middlewares/reqValidators/remote.js | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/server/middlewares/reqValidators/pods.js b/server/middlewares/reqValidators/pods.js index 77449480c..78a4b76c1 100644 --- a/server/middlewares/reqValidators/pods.js +++ b/server/middlewares/reqValidators/pods.js | |||
@@ -26,8 +26,10 @@ function makeFriends (req, res, next) { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | function podsAdd (req, res, next) { | 28 | function podsAdd (req, res, next) { |
29 | req.checkBody('data.url', 'Should have an url').notEmpty().isURL({ require_protocol: true }) | 29 | req.checkBody('url', 'Should have an url').notEmpty().isURL({ require_protocol: true }) |
30 | req.checkBody('data.publicKey', 'Should have a public key').notEmpty() | 30 | req.checkBody('publicKey', 'Should have a public key').notEmpty() |
31 | |||
32 | // TODO: check we don't have it already | ||
31 | 33 | ||
32 | logger.debug('Checking podsAdd parameters', { parameters: req.body }) | 34 | logger.debug('Checking podsAdd parameters', { parameters: req.body }) |
33 | 35 | ||
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 | |||
4 | const logger = require('../../helpers/logger') | 4 | const logger = require('../../helpers/logger') |
5 | 5 | ||
6 | const reqValidatorsRemote = { | 6 | const reqValidatorsRemote = { |
7 | remoteVideosAdd: remoteVideosAdd, | 7 | dataToDecrypt: dataToDecrypt, |
8 | remoteVideosRemove: remoteVideosRemove, | 8 | remoteVideos: remoteVideos, |
9 | secureRequest: secureRequest | 9 | signature: signature |
10 | } | 10 | } |
11 | 11 | ||
12 | function remoteVideosAdd (req, res, next) { | 12 | function 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 | ||
21 | function remoteVideosRemove (req, res, next) { | 21 | function 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 | ||
30 | function secureRequest (req, res, next) { | 30 | function 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 | } |