diff options
Diffstat (limited to 'server/middlewares/activitypub.ts')
-rw-r--r-- | server/middlewares/activitypub.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 0ea522e5c..8e8a3961b 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import { NextFunction, Request, Response, RequestHandler } from 'express' | 1 | import { eachSeries } from 'async' |
2 | import { NextFunction, Request, RequestHandler, Response } from 'express' | ||
2 | import { ActivityPubSignature } from '../../shared' | 3 | import { ActivityPubSignature } from '../../shared' |
3 | import { isSignatureVerified, logger } from '../helpers' | 4 | import { isSignatureVerified, logger } from '../helpers' |
4 | import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub' | 5 | import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub' |
5 | import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers' | 6 | import { database as db } from '../initializers' |
6 | import { each, eachSeries, waterfall } from 'async' | 7 | import { ACTIVITY_PUB } from '../initializers/constants' |
7 | 8 | ||
8 | async function checkSignature (req: Request, res: Response, next: NextFunction) { | 9 | async function checkSignature (req: Request, res: Response, next: NextFunction) { |
9 | const signatureObject: ActivityPubSignature = req.body.signature | 10 | const signatureObject: ActivityPubSignature = req.body.signature |
@@ -37,7 +38,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) | |||
37 | 38 | ||
38 | function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { | 39 | function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { |
39 | return (req: Request, res: Response, next: NextFunction) => { | 40 | return (req: Request, res: Response, next: NextFunction) => { |
40 | if (req.header('Accept') !== ACTIVITY_PUB_ACCEPT_HEADER) { | 41 | if (req.header('Accept') !== ACTIVITY_PUB.ACCEPT_HEADER) { |
41 | return next() | 42 | return next() |
42 | } | 43 | } |
43 | 44 | ||