diff options
Diffstat (limited to 'server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts')
-rw-r--r-- | server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts index 5b4c65b81..49d4bf5c6 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts | |||
@@ -1,21 +1,16 @@ | |||
1 | import { logger } from '../../../helpers' | 1 | import { logger } from '../../../helpers' |
2 | import { buildSignedActivity } from '../../../helpers/activitypub' | ||
3 | import { doRequest } from '../../../helpers/requests' | 2 | import { doRequest } from '../../../helpers/requests' |
4 | import { database as db } from '../../../initializers' | 3 | import { ActivityPubHttpPayload, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler' |
5 | import { ActivityPubHttpPayload, maybeRetryRequestLater } from './activitypub-http-job-scheduler' | ||
6 | 4 | ||
7 | async function process (payload: ActivityPubHttpPayload, jobId: number) { | 5 | async function process (payload: ActivityPubHttpPayload, jobId: number) { |
8 | logger.info('Processing ActivityPub broadcast in job %d.', jobId) | 6 | logger.info('Processing ActivityPub broadcast in job %d.', jobId) |
9 | 7 | ||
10 | const accountSignature = await db.Account.load(payload.signatureAccountId) | 8 | const body = await computeBody(payload) |
11 | if (!accountSignature) throw new Error('Unknown signature account id.') | ||
12 | |||
13 | const signedBody = await buildSignedActivity(accountSignature, payload.body) | ||
14 | 9 | ||
15 | const options = { | 10 | const options = { |
16 | method: 'POST', | 11 | method: 'POST', |
17 | uri: '', | 12 | uri: '', |
18 | json: signedBody | 13 | json: body |
19 | } | 14 | } |
20 | 15 | ||
21 | for (const uri of payload.uris) { | 16 | for (const uri of payload.uris) { |