From 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Nov 2017 17:27:49 +0100 Subject: Make it compile at least --- server/middlewares/validators/activitypub/index.ts | 3 +- server/middlewares/validators/activitypub/pods.ts | 38 ---------------------- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 server/middlewares/validators/activitypub/pods.ts (limited to 'server/middlewares/validators/activitypub') diff --git a/server/middlewares/validators/activitypub/index.ts b/server/middlewares/validators/activitypub/index.ts index f1f26043e..84d1107fc 100644 --- a/server/middlewares/validators/activitypub/index.ts +++ b/server/middlewares/validators/activitypub/index.ts @@ -1,3 +1,2 @@ -export * from './pods' +export * from './activity' export * from './signature' -export * from './videos' diff --git a/server/middlewares/validators/activitypub/pods.ts b/server/middlewares/validators/activitypub/pods.ts deleted file mode 100644 index f917b61ee..000000000 --- a/server/middlewares/validators/activitypub/pods.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { body } from 'express-validator/check' -import * as express from 'express' - -import { database as db } from '../../../initializers' -import { isHostValid, logger } from '../../../helpers' -import { checkErrors } from '../utils' - -const remotePodsAddValidator = [ - body('host').custom(isHostValid).withMessage('Should have a host'), - body('email').isEmail().withMessage('Should have an email'), - body('publicKey').not().isEmpty().withMessage('Should have a public key'), - - (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking podsAdd parameters', { parameters: req.body }) - - checkErrors(req, res, () => { - db.Pod.loadByHost(req.body.host) - .then(pod => { - // Pod with this host already exists - if (pod) { - return res.sendStatus(409) - } - - return next() - }) - .catch(err => { - logger.error('Cannot load pod by host.', err) - res.sendStatus(500) - }) - }) - } -] - -// --------------------------------------------------------------------------- - -export { - remotePodsAddValidator -} -- cgit v1.2.3