diff options
Diffstat (limited to 'server/middlewares/activitypub.ts')
-rw-r--r-- | server/middlewares/activitypub.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 485645720..c2ad18195 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts | |||
@@ -3,7 +3,7 @@ import { NextFunction, Request, RequestHandler, Response } from 'express' | |||
3 | import { ActivityPubSignature } from '../../shared' | 3 | import { ActivityPubSignature } from '../../shared' |
4 | import { isSignatureVerified, logger } from '../helpers' | 4 | import { isSignatureVerified, logger } from '../helpers' |
5 | import { database as db } from '../initializers' | 5 | import { database as db } from '../initializers' |
6 | import { ACTIVITY_PUB } from '../initializers/constants' | 6 | import { ACCEPT_HEADERS, ACTIVITY_PUB } from '../initializers/constants' |
7 | import { fetchRemoteAccount, saveAccountAndServerIfNotExist } from '../lib/activitypub/account' | 7 | import { fetchRemoteAccount, saveAccountAndServerIfNotExist } from '../lib/activitypub/account' |
8 | 8 | ||
9 | async function checkSignature (req: Request, res: Response, next: NextFunction) { | 9 | async function checkSignature (req: Request, res: Response, next: NextFunction) { |
@@ -37,7 +37,8 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) | |||
37 | 37 | ||
38 | function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { | 38 | function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { |
39 | return (req: Request, res: Response, next: NextFunction) => { | 39 | return (req: Request, res: Response, next: NextFunction) => { |
40 | if (!req.accepts(ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS)) { | 40 | const accepted = req.accepts(ACCEPT_HEADERS) |
41 | if (accepted === false || ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS.indexOf(accepted) === -1) { | ||
41 | return next() | 42 | return next() |
42 | } | 43 | } |
43 | 44 | ||