diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/pods.js | 7 |
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 | ||
3 | const checkErrors = require('./utils').checkErrors | 3 | const checkErrors = require('./utils').checkErrors |
4 | const constants = require('../../initializers/constants') | ||
4 | const friends = require('../../lib/friends') | 5 | const friends = require('../../lib/friends') |
5 | const logger = require('../../helpers/logger') | 6 | const logger = require('../../helpers/logger') |
7 | const utils = require('../../helpers/utils') | ||
6 | 8 | ||
7 | const validatorsPod = { | 9 | const validatorsPod = { |
8 | makeFriends, | 10 | makeFriends, |
@@ -10,6 +12,11 @@ const validatorsPod = { | |||
10 | } | 12 | } |
11 | 13 | ||
12 | function makeFriends (req, res, next) { | 14 | function 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 }) |