aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/pods.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/middlewares/validators/pods.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip
Type functions
Diffstat (limited to 'server/middlewares/validators/pods.ts')
-rw-r--r--server/middlewares/validators/pods.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/middlewares/validators/pods.ts b/server/middlewares/validators/pods.ts
index c55a88b85..d8eb90168 100644
--- a/server/middlewares/validators/pods.ts
+++ b/server/middlewares/validators/pods.ts
@@ -1,3 +1,6 @@
1import 'express-validator'
2import * as express from 'express'
3
1import { database as db } from '../../initializers/database' 4import { database as db } from '../../initializers/database'
2import { checkErrors } from './utils' 5import { checkErrors } from './utils'
3import { logger } from '../../helpers' 6import { logger } from '../../helpers'
@@ -5,7 +8,7 @@ import { CONFIG } from '../../initializers'
5import { hasFriends } from '../../lib' 8import { hasFriends } from '../../lib'
6import { isTestInstance } from '../../helpers' 9import { isTestInstance } from '../../helpers'
7 10
8function makeFriendsValidator (req, res, next) { 11function makeFriendsValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
9 // Force https if the administrator wants to make friends 12 // Force https if the administrator wants to make friends
10 if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') { 13 if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') {
11 return res.status(400).send('Cannot make friends with a non HTTPS webserver.') 14 return res.status(400).send('Cannot make friends with a non HTTPS webserver.')
@@ -32,7 +35,7 @@ function makeFriendsValidator (req, res, next) {
32 }) 35 })
33} 36}
34 37
35function podsAddValidator (req, res, next) { 38function podsAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
36 req.checkBody('host', 'Should have a host').isHostValid() 39 req.checkBody('host', 'Should have a host').isHostValid()
37 req.checkBody('email', 'Should have an email').isEmail() 40 req.checkBody('email', 'Should have an email').isEmail()
38 req.checkBody('publicKey', 'Should have a public key').notEmpty() 41 req.checkBody('publicKey', 'Should have a public key').notEmpty()