mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Upgrade server dependencies
This commit is contained in:
parent
228e84aa7e
commit
ee28cdf1c4
5 changed files with 224 additions and 170 deletions
|
@ -6,24 +6,23 @@ import { getServerActor } from '../../../helpers/utils'
|
|||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { areValidationErrors } from '../utils'
|
||||
|
||||
const activityPubValidator = [
|
||||
body('').custom((value, { req }) => isRootActivityValid(req.body)),
|
||||
async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
logger.debug('Checking activity pub parameters')
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking activity pub parameters')
|
||||
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
||||
const serverActor = await getServerActor()
|
||||
const remoteActor = res.locals.signature.actor as ActorModel
|
||||
if (serverActor.id === remoteActor.id) {
|
||||
logger.error('Receiving request in INBOX by ourselves!', req.body)
|
||||
return res.status(409).end()
|
||||
}
|
||||
|
||||
return next()
|
||||
if (!isRootActivityValid(req.body)) {
|
||||
logger.warn('Incorrect activity parameters.', { activity: req.body })
|
||||
return res.status(400).json({ error: 'Incorrect activity.' })
|
||||
}
|
||||
]
|
||||
|
||||
const serverActor = await getServerActor()
|
||||
const remoteActor = res.locals.signature.actor as ActorModel
|
||||
if (serverActor.id === remoteActor.id) {
|
||||
logger.error('Receiving request in INBOX by ourselves!', req.body)
|
||||
return res.status(409).end()
|
||||
}
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue