]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/activitypub/activity.ts
Fix preview 404
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / activitypub / activity.ts
CommitLineData
0d0e8dd0 1import * as express from 'express'
350e31d6 2import { body } from 'express-validator/check'
3fd3ab2d
C
3import { logger } from '../../../helpers'
4import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub'
a2431b7d 5import { areValidationErrors } from '../utils'
0d0e8dd0
C
6
7const activityPubValidator = [
350e31d6 8 body('').custom((value, { req }) => isRootActivityValid(req.body)),
0d0e8dd0
C
9
10 (req: express.Request, res: express.Response, next: express.NextFunction) => {
fef2c716 11 logger.debug('Checking activity pub parameters')
0d0e8dd0 12
a2431b7d
C
13 if (areValidationErrors(req, res)) return
14
15 return next()
0d0e8dd0
C
16 }
17]
18
19// ---------------------------------------------------------------------------
20
21export {
22 activityPubValidator
23}