diff options
Diffstat (limited to 'server/middlewares/validators/servers.ts')
-rw-r--r-- | server/middlewares/validators/servers.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/server/middlewares/validators/servers.ts b/server/middlewares/validators/servers.ts deleted file mode 100644 index 95b69b789..000000000 --- a/server/middlewares/validators/servers.ts +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | import * as express from 'express' | ||
2 | import { body } from 'express-validator/check' | ||
3 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' | ||
4 | import { isTestInstance } from '../../helpers/core-utils' | ||
5 | import { CONFIG } from '../../initializers/constants' | ||
6 | import { logger } from '../../helpers/logger' | ||
7 | import { checkErrors } from './utils' | ||
8 | |||
9 | const followValidator = [ | ||
10 | body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), | ||
11 | |||
12 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
13 | // Force https if the administrator wants to make friends | ||
14 | if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') { | ||
15 | return res.status(400) | ||
16 | .json({ | ||
17 | error: 'Cannot follow non HTTPS web server.' | ||
18 | }) | ||
19 | .end() | ||
20 | } | ||
21 | |||
22 | logger.debug('Checking follow parameters', { parameters: req.body }) | ||
23 | |||
24 | checkErrors(req, res, next) | ||
25 | } | ||
26 | ] | ||
27 | |||
28 | // --------------------------------------------------------------------------- | ||
29 | |||
30 | export { | ||
31 | followValidator | ||
32 | } | ||