]>
Commit | Line | Data |
---|---|---|
0d0e8dd0 | 1 | import * as express from 'express' |
350e31d6 C |
2 | import { body } from 'express-validator/check' |
3 | import { isRootActivityValid, logger } from '../../../helpers' | |
a2431b7d | 4 | import { areValidationErrors } from '../utils' |
0d0e8dd0 C |
5 | |
6 | const activityPubValidator = [ | |
350e31d6 | 7 | body('').custom((value, { req }) => isRootActivityValid(req.body)), |
0d0e8dd0 C |
8 | |
9 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | |
10 | logger.debug('Checking activity pub parameters', { parameters: req.body }) | |
11 | ||
a2431b7d C |
12 | if (areValidationErrors(req, res)) return |
13 | ||
14 | return next() | |
0d0e8dd0 C |
15 | } |
16 | ] | |
17 | ||
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | export { | |
21 | activityPubValidator | |
22 | } |