From 54141398354e6e7b94aa3065a705a1251390111c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 20 Nov 2017 09:43:39 +0100 Subject: Refractor activity pub lib/helpers --- server/middlewares/validators/servers.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 server/middlewares/validators/servers.ts (limited to 'server/middlewares/validators/servers.ts') 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 @@ -import * as express from 'express' -import { body } from 'express-validator/check' -import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' -import { isTestInstance } from '../../helpers/core-utils' -import { CONFIG } from '../../initializers/constants' -import { logger } from '../../helpers/logger' -import { checkErrors } from './utils' - -const followValidator = [ - body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), - - (req: express.Request, res: express.Response, next: express.NextFunction) => { - // Force https if the administrator wants to make friends - if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') { - return res.status(400) - .json({ - error: 'Cannot follow non HTTPS web server.' - }) - .end() - } - - logger.debug('Checking follow parameters', { parameters: req.body }) - - checkErrors(req, res, next) - } -] - -// --------------------------------------------------------------------------- - -export { - followValidator -} -- cgit v1.2.3