aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/activitypub
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-10 17:27:49 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch)
treee57173bcd0590d939c28952a29258fd02a281e35 /server/middlewares/validators/activitypub
parent38fa2065831b5f55be0d7f30f19a62c967397208 (diff)
downloadPeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz
PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst
PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip
Make it compile at least
Diffstat (limited to 'server/middlewares/validators/activitypub')
-rw-r--r--server/middlewares/validators/activitypub/index.ts3
-rw-r--r--server/middlewares/validators/activitypub/pods.ts38
2 files changed, 1 insertions, 40 deletions
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 @@
1export * from './pods' 1export * from './activity'
2export * from './signature' 2export * from './signature'
3export * 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 @@
1import { body } from 'express-validator/check'
2import * as express from 'express'
3
4import { database as db } from '../../../initializers'
5import { isHostValid, logger } from '../../../helpers'
6import { checkErrors } from '../utils'
7
8const remotePodsAddValidator = [
9 body('host').custom(isHostValid).withMessage('Should have a host'),
10 body('email').isEmail().withMessage('Should have an email'),
11 body('publicKey').not().isEmpty().withMessage('Should have a public key'),
12
13 (req: express.Request, res: express.Response, next: express.NextFunction) => {
14 logger.debug('Checking podsAdd parameters', { parameters: req.body })
15
16 checkErrors(req, res, () => {
17 db.Pod.loadByHost(req.body.host)
18 .then(pod => {
19 // Pod with this host already exists
20 if (pod) {
21 return res.sendStatus(409)
22 }
23
24 return next()
25 })
26 .catch(err => {
27 logger.error('Cannot load pod by host.', err)
28 res.sendStatus(500)
29 })
30 })
31 }
32]
33
34// ---------------------------------------------------------------------------
35
36export {
37 remotePodsAddValidator
38}