summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/RelayService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/RelayService.ts')
-rw-r--r--packages/backend/src/core/RelayService.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/backend/src/core/RelayService.ts b/packages/backend/src/core/RelayService.ts
index ad01f98902..8dd3d64f5b 100644
--- a/packages/backend/src/core/RelayService.ts
+++ b/packages/backend/src/core/RelayService.ts
@@ -16,8 +16,6 @@ import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { DI } from '@/di-symbols.js';
import { deepClone } from '@/misc/clone.js';
import { bindThis } from '@/decorators.js';
-import { UserKeypairService } from './UserKeypairService.js';
-import type { PrivateKeyWithPem } from '@misskey-dev/node-http-message-signatures';
const ACTOR_USERNAME = 'relay.actor' as const;
@@ -36,7 +34,6 @@ export class RelayService {
private queueService: QueueService,
private createSystemUserService: CreateSystemUserService,
private apRendererService: ApRendererService,
- private userKeypairService: UserKeypairService,
) {
this.relaysCache = new MemorySingleCache<MiRelay[]>(1000 * 60 * 10);
}
@@ -114,7 +111,7 @@ export class RelayService {
}
@bindThis
- public async deliverToRelays(user: { id: MiUser['id']; host: null; }, activity: any, privateKey?: PrivateKeyWithPem): Promise<void> {
+ public async deliverToRelays(user: { id: MiUser['id']; host: null; }, activity: any): Promise<void> {
if (activity == null) return;
const relays = await this.relaysCache.fetch(() => this.relaysRepository.findBy({
@@ -124,9 +121,11 @@ export class RelayService {
const copy = deepClone(activity);
if (!copy.to) copy.to = ['https://www.w3.org/ns/activitystreams#Public'];
- privateKey = privateKey ?? await this.userKeypairService.getLocalUserPrivateKeyPem(user.id);
- const signed = await this.apRendererService.attachLdSignature(copy, privateKey);
- this.queueService.deliverMany(user, signed, new Map(relays.map(({ inbox }) => [inbox, false])), privateKey);
+ const signed = await this.apRendererService.attachLdSignature(copy, user);
+
+ for (const relay of relays) {
+ this.queueService.deliver(user, signed, relay.inbox, false);
+ }
}
}