diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-07 11:33:59 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-07 11:33:59 +0100 |
commit | b9a3e09ad5a7673f64556d1dba122ed4c4fac980 (patch) | |
tree | 66d4928b82af19a2372a2505822233884f3fd471 /middlewares/reqValidators/pods.js | |
parent | b2ff5e3e686eb552c5ccd64ce67b0455972ceef0 (diff) | |
download | PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.gz PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.zst PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.zip |
Prepare folders structure for angular app
Diffstat (limited to 'middlewares/reqValidators/pods.js')
-rw-r--r-- | middlewares/reqValidators/pods.js | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/middlewares/reqValidators/pods.js b/middlewares/reqValidators/pods.js deleted file mode 100644 index ef09d51cf..000000000 --- a/middlewares/reqValidators/pods.js +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | var checkErrors = require('./utils').checkErrors | ||
4 | var friends = require('../../lib/friends') | ||
5 | var logger = require('../../helpers/logger') | ||
6 | |||
7 | var reqValidatorsPod = { | ||
8 | makeFriends: makeFriends, | ||
9 | podsAdd: podsAdd | ||
10 | } | ||
11 | |||
12 | function makeFriends (req, res, next) { | ||
13 | friends.hasFriends(function (err, has_friends) { | ||
14 | if (err) { | ||
15 | logger.error('Cannot know if we have friends.', { error: err }) | ||
16 | res.sendStatus(500) | ||
17 | } | ||
18 | |||
19 | if (has_friends === true) { | ||
20 | // We need to quit our friends before make new ones | ||
21 | res.sendStatus(409) | ||
22 | } else { | ||
23 | return next() | ||
24 | } | ||
25 | }) | ||
26 | } | ||
27 | |||
28 | function podsAdd (req, res, next) { | ||
29 | req.checkBody('data.url', 'Should have an url').notEmpty().isURL({ require_protocol: true }) | ||
30 | req.checkBody('data.publicKey', 'Should have a public key').notEmpty() | ||
31 | |||
32 | logger.debug('Checking podsAdd parameters', { parameters: req.body }) | ||
33 | |||
34 | checkErrors(req, res, next) | ||
35 | } | ||
36 | |||
37 | // --------------------------------------------------------------------------- | ||
38 | |||
39 | module.exports = reqValidatorsPod | ||