]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/reqValidators/pods.js
3 const checkErrors
= require('./utils').checkErrors
4 const friends
= require('../../lib/friends')
5 const logger
= require('../../helpers/logger')
7 const reqValidatorsPod
= {
8 makeFriends: makeFriends
,
12 function makeFriends (req
, res
, next
) {
13 friends
.hasFriends(function (err
, has_friends
) {
15 logger
.error('Cannot know if we have friends.', { error: err
})
19 if (has_friends
=== true) {
20 // We need to quit our friends before make new ones
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()
32 logger
.debug('Checking podsAdd parameters', { parameters: req
.body
})
34 checkErrors(req
, res
, next
)
37 // ---------------------------------------------------------------------------
39 module
.exports
= reqValidatorsPod