summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/QueueService.ts
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2024-01-06 09:07:48 +0900
committerGitHub <noreply@github.com>2024-01-06 09:07:48 +0900
commitd415fd29a3b0fb7f337423fff8318ec393928875 (patch)
tree5a8506ebf0c7a33456a375ba961c642460c7b530 /packages/backend/src/core/QueueService.ts
parentrefactor(frontend): reduce type errors (diff)
downloadsharkey-d415fd29a3b0fb7f337423fff8318ec393928875.tar.gz
sharkey-d415fd29a3b0fb7f337423fff8318ec393928875.tar.bz2
sharkey-d415fd29a3b0fb7f337423fff8318ec393928875.zip
enhance(backend): ActivityPub Deliver queueでBodyを事前処理するように (#12916)
* Pre-processing deliver body * CHANGELOG * ループ内で計算されると意味がないので * 同じ処理を同じ形に --------- Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/core/QueueService.ts')
-rw-r--r--packages/backend/src/core/QueueService.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts
index be378a899b..4f99dee64e 100644
--- a/packages/backend/src/core/QueueService.ts
+++ b/packages/backend/src/core/QueueService.ts
@@ -16,6 +16,7 @@ import type { DbQueue, DeliverQueue, EndedPollNotificationQueue, InboxQueue, Obj
import type { DbJobData, DeliverJobData, RelationshipJobData, ThinUser } from '../queue/types.js';
import type httpSignature from '@peertube/http-signature';
import type * as Bull from 'bullmq';
+import { ApRequestCreator } from '@/core/activitypub/ApRequestService.js';
@Injectable()
export class QueueService {
@@ -74,11 +75,15 @@ export class QueueService {
if (content == null) return null;
if (to == null) return null;
+ const contentBody = JSON.stringify(content);
+ const digest = ApRequestCreator.createDigest(contentBody);
+
const data: DeliverJobData = {
user: {
id: user.id,
},
- content,
+ content: contentBody,
+ digest,
to,
isSharedInbox,
};
@@ -103,6 +108,8 @@ export class QueueService {
@bindThis
public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>) {
if (content == null) return null;
+ const contentBody = JSON.stringify(content);
+ const digest = ApRequestCreator.createDigest(contentBody);
const opts = {
attempts: this.config.deliverJobMaxAttempts ?? 12,
@@ -117,7 +124,8 @@ export class QueueService {
name: d[0],
data: {
user,
- content,
+ content: contentBody,
+ digest,
to: d[0],
isSharedInbox: d[1],
} as DeliverJobData,