aboutsummaryrefslogtreecommitdiffhomepage
path: root/middlewares/reqValidators/remote.js
diff options
context:
space:
mode:
Diffstat (limited to 'middlewares/reqValidators/remote.js')
-rw-r--r--middlewares/reqValidators/remote.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/middlewares/reqValidators/remote.js b/middlewares/reqValidators/remote.js
new file mode 100644
index 000000000..e851b49a4
--- /dev/null
+++ b/middlewares/reqValidators/remote.js
@@ -0,0 +1,40 @@
1;(function () {
2 'use strict'
3
4 var checkErrors = require('./utils').checkErrors
5 var logger = require('../../src/logger')
6
7 var remote = {}
8
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()
14
15 logger.debug('Checking secureRequest parameters', { parameters: req.body })
16
17 checkErrors(req, res, next)
18 }
19
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()
25
26 logger.debug('Checking remoteVideosAdd parameters', { parameters: req.body })
27
28 checkErrors(req, res, next)
29 }
30
31 remote.remoteVideosRemove = function (req, res, next) {
32 req.checkBody('data.magnetUri', 'Should have a magnetUri').notEmpty()
33
34 logger.debug('Checking remoteVideosRemove parameters', { parameters: req.body })
35
36 checkErrors(req, res, next)
37 }
38
39 module.exports = remote
40})()