From e12a009254de33bcdbd8334992980fa029c3e10d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Dec 2017 10:34:56 +0100 Subject: Status are sent to mastodon --- server/middlewares/activitypub.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 37b7c42ec..9113e02a7 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -9,11 +9,13 @@ import { ActorModel } from '../models/activitypub/actor' async function checkSignature (req: Request, res: Response, next: NextFunction) { const signatureObject: ActivityPubSignature = req.body.signature - logger.debug('Checking signature of actor %s...', signatureObject.creator) + const [ creator ] = signatureObject.creator.split('#') + + logger.debug('Checking signature of actor %s...', creator) let actor: ActorModel try { - actor = await getOrCreateActorAndServerAndModel(signatureObject.creator) + actor = await getOrCreateActorAndServerAndModel(creator) } catch (err) { logger.error('Cannot create remote actor and check signature.', err) return res.sendStatus(403) @@ -32,6 +34,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { return (req: Request, res: Response, next: NextFunction) => { const accepted = req.accepts(ACCEPT_HEADERS) + console.log(accepted) if (accepted === false || ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS.indexOf(accepted) === -1) { return next() } -- cgit v1.2.3