]>
Commit | Line | Data |
---|---|---|
0d0e8dd0 | 1 | import * as express from 'express' |
350e31d6 | 2 | import { body } from 'express-validator/check' |
3fd3ab2d C |
3 | import { logger } from '../../../helpers' |
4 | import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub' | |
a2431b7d | 5 | import { areValidationErrors } from '../utils' |
0d0e8dd0 C |
6 | |
7 | const 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 | ||
21 | export { | |
22 | activityPubValidator | |
23 | } |