summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/QueueService.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2024-07-20 21:33:20 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2024-07-20 21:33:20 +0900
commit337b42bcb179bdfb993888ed94342a0158e8f3cb (patch)
treebd40424cf34c72b17effe19e5ce3cf866b3c6241 /packages/backend/src/core/QueueService.ts
parentdocs(misskey-js): fix broken i-want-you image link in README.md (#14265) (diff)
downloadsharkey-337b42bcb179bdfb993888ed94342a0158e8f3cb.tar.gz
sharkey-337b42bcb179bdfb993888ed94342a0158e8f3cb.tar.bz2
sharkey-337b42bcb179bdfb993888ed94342a0158e8f3cb.zip
revert 5f88d56d96
バグがある(かつすぐに修正できそうにない) & まだレビュー途中で意図せずマージされたため
Diffstat (limited to 'packages/backend/src/core/QueueService.ts')
-rw-r--r--packages/backend/src/core/QueueService.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts
index dd3f2182b4..80827a500b 100644
--- a/packages/backend/src/core/QueueService.ts
+++ b/packages/backend/src/core/QueueService.ts
@@ -13,6 +13,7 @@ import type { Config } from '@/config.js';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
import type { Antenna } from '@/server/api/endpoints/i/import-antennas.js';
+import { ApRequestCreator } from '@/core/activitypub/ApRequestService.js';
import type {
DbJobData,
DeliverJobData,
@@ -32,7 +33,7 @@ import type {
UserWebhookDeliverQueue,
SystemWebhookDeliverQueue,
} from './QueueModule.js';
-import { genRFC3230DigestHeader, type PrivateKeyWithPem, type ParsedSignature } from '@misskey-dev/node-http-message-signatures';
+import type httpSignature from '@peertube/http-signature';
import type * as Bull from 'bullmq';
@Injectable()
@@ -89,21 +90,21 @@ export class QueueService {
}
@bindThis
- public async deliver(user: ThinUser, content: IActivity | null, to: string | null, isSharedInbox: boolean, privateKey?: PrivateKeyWithPem) {
+ public deliver(user: ThinUser, content: IActivity | null, to: string | null, isSharedInbox: boolean) {
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: contentBody,
- digest: await genRFC3230DigestHeader(contentBody, 'SHA-256'),
+ digest,
to,
isSharedInbox,
- privateKey: privateKey && { keyId: privateKey.keyId, privateKeyPem: privateKey.privateKeyPem },
};
return this.deliverQueue.add(to, data, {
@@ -121,13 +122,13 @@ export class QueueService {
* @param user `{ id: string; }` この関数ではThinUserに変換しないので前もって変換してください
* @param content IActivity | null
* @param inboxes `Map<string, boolean>` / key: to (inbox url), value: isSharedInbox (whether it is sharedInbox)
- * @param forceMainKey boolean | undefined, force to use main (rsa) key
* @returns void
*/
@bindThis
- public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>, privateKey?: PrivateKeyWithPem) {
+ 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,
@@ -143,9 +144,9 @@ export class QueueService {
data: {
user,
content: contentBody,
+ digest,
to: d[0],
isSharedInbox: d[1],
- privateKey: privateKey && { keyId: privateKey.keyId, privateKeyPem: privateKey.privateKeyPem },
} as DeliverJobData,
opts,
})));
@@ -154,7 +155,7 @@ export class QueueService {
}
@bindThis
- public inbox(activity: IActivity, signature: ParsedSignature | null) {
+ public inbox(activity: IActivity, signature: httpSignature.IParsedSignature) {
const data = {
activity: activity,
signature,