]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts
Begin moving video channel to actor
[github/Chocobozzz/PeerTube.git] / server / lib / jobs / activitypub-http-job-scheduler / activitypub-http-unicast-handler.ts
index f7f3dabbd383be0e852f8483c3672d8885f7aeb8..f16cfcec3d898a7793bc3913eb6b9b9528f08960 100644 (file)
@@ -1,21 +1,16 @@
-import { logger } from '../../../helpers'
-import { doRequest } from '../../../helpers/requests'
-import { ActivityPubHttpPayload, maybeRetryRequestLater } from './activitypub-http-job-scheduler'
-import { database as db } from '../../../initializers/database'
-import { buildSignedActivity } from '../../../helpers/activitypub'
+import { doRequest, logger } from '../../../helpers'
+import { ActivityPubHttpPayload, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler'
 
 async function process (payload: ActivityPubHttpPayload, jobId: number) {
   logger.info('Processing ActivityPub unicast in job %d.', jobId)
 
-  const accountSignature = await db.Account.load(payload.signatureAccountId)
-  if (!accountSignature) throw new Error('Unknown signature account id.')
+  const body = await computeBody(payload)
 
-  const signedBody = await buildSignedActivity(accountSignature, payload.body)
   const uri = payload.uris[0]
   const options = {
     method: 'POST',
     uri,
-    json: signedBody
+    json: body
   }
 
   try {