aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/middlewares/validators/activitypub/activity.ts
blob: 208e23f8692c1872640b7f9393ef5fba4ba39391 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                  
                                              

                                                                                             
                                              

                              
                                                                     

                                                                                
                                                    
 


                                             







                                                                              
import * as express from 'express'
import { body } from 'express-validator/check'
import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
import { logger } from '../../../helpers/logger'
import { areValidationErrors } from '../utils'

const activityPubValidator = [
  body('').custom((value, { req }) => isRootActivityValid(req.body)),

  (req: express.Request, res: express.Response, next: express.NextFunction) => {
    logger.debug('Checking activity pub parameters')

    if (areValidationErrors(req, res)) return

    return next()
  }
]

// ---------------------------------------------------------------------------

export {
  activityPubValidator
}