aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/activitypub.ts9
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 @@
1import { NextFunction, Request, Response, RequestHandler } from 'express' 1import { eachSeries } from 'async'
2import { NextFunction, Request, RequestHandler, Response } from 'express'
2import { ActivityPubSignature } from '../../shared' 3import { ActivityPubSignature } from '../../shared'
3import { isSignatureVerified, logger } from '../helpers' 4import { isSignatureVerified, logger } from '../helpers'
4import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub' 5import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub'
5import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers' 6import { database as db } from '../initializers'
6import { each, eachSeries, waterfall } from 'async' 7import { ACTIVITY_PUB } from '../initializers/constants'
7 8
8async function checkSignature (req: Request, res: Response, next: NextFunction) { 9async 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
38function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { 39function 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