X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fpods.ts;h=d8eb90168a1c1014453461fc1d0d25fe80683432;hb=5fe7e898316e18369c3e1aba307b55077adc7bfb;hp=fbfd268d05e1d9a2b572cb072a2ccf4d8751dfdf;hpb=65fcc3119c334b75dd13bcfdebf186afdc580a8f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/pods.ts b/server/middlewares/validators/pods.ts index fbfd268d0..d8eb90168 100644 --- a/server/middlewares/validators/pods.ts +++ b/server/middlewares/validators/pods.ts @@ -1,11 +1,14 @@ -const db = require('../../initializers/database') +import 'express-validator' +import * as express from 'express' + +import { database as db } from '../../initializers/database' import { checkErrors } from './utils' import { logger } from '../../helpers' import { CONFIG } from '../../initializers' import { hasFriends } from '../../lib' import { isTestInstance } from '../../helpers' -function makeFriendsValidator (req, res, next) { +function makeFriendsValidator (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).send('Cannot make friends with a non HTTPS webserver.') @@ -32,7 +35,7 @@ function makeFriendsValidator (req, res, next) { }) } -function podsAddValidator (req, res, next) { +function podsAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) { req.checkBody('host', 'Should have a host').isHostValid() req.checkBody('email', 'Should have an email').isEmail() req.checkBody('publicKey', 'Should have a public key').notEmpty()