From 60fd848182ac1a07528bfe1dd2af52beccc1c363 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 15 Jul 2023 14:24:05 +0000 Subject: [PATCH] configable --- chart/files/default.yml | 4 ++++ packages/backend/src/config.ts | 1 + .../backend/src/core/activitypub/models/ApPersonService.ts | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/chart/files/default.yml b/chart/files/default.yml index e62032abf..8fd259b67 100644 --- a/chart/files/default.yml +++ b/chart/files/default.yml @@ -186,6 +186,10 @@ id: "aid" # Sign to ActivityPub GET request (default: true) signToActivityPubGet: true +# Limit of notes to fetch from outbox with remote user first fetched (default: 5) +# https://github.com/misskey-dev/misskey/pull/11130 +outboxNotesFetchLimit: 5 + #allowedPrivateNetworks: [ # '127.0.0.1/32' #] diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index 23ed6e59b..55a3cd210 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -96,6 +96,7 @@ export type Source = { videoThumbnailGenerator?: string; signToActivityPubGet?: boolean; + outboxNotesFetchLimit?: number; }; /** diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 6663fdc05..f92743dce 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -638,6 +638,8 @@ export class ApPersonService implements OnModuleInit { * This only retrieves the first page for now. */ public async updateOutboxFirstPage(user: RemoteUser, outbox: IActor['outbox'], resolver: Resolver): Promise { + if (!this.config.outboxNotesFetchLimit) return; + // https://www.w3.org/TR/activitypub/#actor-objects // Outbox is a required property for all actors if (!outbox) { @@ -655,8 +657,8 @@ export class ApPersonService implements OnModuleInit { await resolver.resolveOrderedCollectionPage(collection.first) : collection; - // Perform activity but only the first 20 ones with `type: Create` - await this.apInboxService.performActivity(user, firstPage, { limit: 20, allow: ['Create'] }); + // Perform activity but only the first outboxNotesFetchLimit ones with `type: Create` + await this.apInboxService.performActivity(user, firstPage, { limit: this.config.outboxNotesFetchLimit, allow: ['Create'] }); } /**