diff options
Diffstat (limited to 'server/lib/job-queue/handlers/activitypub-http-unicast.ts')
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-http-unicast.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/lib/job-queue/handlers/activitypub-http-unicast.ts deleted file mode 100644 index 50fca3f94..000000000 --- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | import { Job } from 'bullmq' | ||
2 | import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from '@server/lib/activitypub/send' | ||
3 | import { ActivitypubHttpUnicastPayload } from '@shared/models' | ||
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { doRequest } from '../../../helpers/requests' | ||
6 | import { ActorFollowHealthCache } from '../../actor-follow-health-cache' | ||
7 | |||
8 | async function processActivityPubHttpUnicast (job: Job) { | ||
9 | logger.info('Processing ActivityPub unicast in job %s.', job.id) | ||
10 | |||
11 | const payload = job.data as ActivitypubHttpUnicastPayload | ||
12 | const uri = payload.uri | ||
13 | |||
14 | const body = await computeBody(payload) | ||
15 | const httpSignatureOptions = await buildSignedRequestOptions({ signatureActorId: payload.signatureActorId, hasPayload: true }) | ||
16 | |||
17 | const options = { | ||
18 | method: 'POST' as 'POST', | ||
19 | json: body, | ||
20 | httpSignature: httpSignatureOptions, | ||
21 | headers: buildGlobalHeaders(body) | ||
22 | } | ||
23 | |||
24 | try { | ||
25 | await doRequest(uri, options) | ||
26 | ActorFollowHealthCache.Instance.updateActorFollowsHealth([ uri ], []) | ||
27 | } catch (err) { | ||
28 | ActorFollowHealthCache.Instance.updateActorFollowsHealth([], [ uri ]) | ||
29 | |||
30 | throw err | ||
31 | } | ||
32 | } | ||
33 | |||
34 | // --------------------------------------------------------------------------- | ||
35 | |||
36 | export { | ||
37 | processActivityPubHttpUnicast | ||
38 | } | ||