diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
commit | 69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch) | |
tree | ad199a18ec3c322460d6f9523fc383ee562554e0 /server/middlewares/validators/pods.ts | |
parent | 4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff) | |
download | PeerTube-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.ts | 7 |
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 @@ | |||
1 | import 'express-validator' | ||
2 | import * as express from 'express' | ||
3 | |||
1 | import { database as db } from '../../initializers/database' | 4 | import { database as db } from '../../initializers/database' |
2 | import { checkErrors } from './utils' | 5 | import { checkErrors } from './utils' |
3 | import { logger } from '../../helpers' | 6 | import { logger } from '../../helpers' |
@@ -5,7 +8,7 @@ import { CONFIG } from '../../initializers' | |||
5 | import { hasFriends } from '../../lib' | 8 | import { hasFriends } from '../../lib' |
6 | import { isTestInstance } from '../../helpers' | 9 | import { isTestInstance } from '../../helpers' |
7 | 10 | ||
8 | function makeFriendsValidator (req, res, next) { | 11 | function 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 | ||
35 | function podsAddValidator (req, res, next) { | 38 | function 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() |