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