aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-16 20:22:17 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-16 20:29:26 +0100
commit441b66f80923d1f574a74582f1fb9306b99fc12a (patch)
treeed8a853b9df3666772ec4c027a03c7e05651423c /server/middlewares/validators/pods.js
parent9c89a45cb2a7bb46e68fb084723a2046b12c7617 (diff)
downloadPeerTube-441b66f80923d1f574a74582f1fb9306b99fc12a.tar.gz
PeerTube-441b66f80923d1f574a74582f1fb9306b99fc12a.tar.zst
PeerTube-441b66f80923d1f574a74582f1fb9306b99fc12a.zip
Server: forbid to make friends with a non https server
Diffstat (limited to 'server/middlewares/validators/pods.js')
-rw-r--r--server/middlewares/validators/pods.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/middlewares/validators/pods.js b/server/middlewares/validators/pods.js
index 4f8bad2f9..0723871b2 100644
--- a/server/middlewares/validators/pods.js
+++ b/server/middlewares/validators/pods.js
@@ -1,8 +1,10 @@
1'use strict' 1'use strict'
2 2
3const checkErrors = require('./utils').checkErrors 3const checkErrors = require('./utils').checkErrors
4const constants = require('../../initializers/constants')
4const friends = require('../../lib/friends') 5const friends = require('../../lib/friends')
5const logger = require('../../helpers/logger') 6const logger = require('../../helpers/logger')
7const utils = require('../../helpers/utils')
6 8
7const validatorsPod = { 9const validatorsPod = {
8 makeFriends, 10 makeFriends,
@@ -10,6 +12,11 @@ const validatorsPod = {
10} 12}
11 13
12function makeFriends (req, res, next) { 14function makeFriends (req, res, next) {
15 // Force https if the administrator wants to make friends
16 if (utils.isTestInstance() === false && constants.CONFIG.WEBSERVER.SCHEME === 'http') {
17 return res.status(400).send('Cannot make friends with a non HTTPS webserver.')
18 }
19
13 req.checkBody('hosts', 'Should have an array of unique hosts').isEachUniqueHostValid() 20 req.checkBody('hosts', 'Should have an array of unique hosts').isEachUniqueHostValid()
14 21
15 logger.debug('Checking makeFriends parameters', { parameters: req.body }) 22 logger.debug('Checking makeFriends parameters', { parameters: req.body })