configable

This commit is contained in:
tamaina 2023-07-15 14:24:05 +00:00
parent 76def0032e
commit 60fd848182
3 changed files with 9 additions and 2 deletions

View file

@ -186,6 +186,10 @@ id: "aid"
# Sign to ActivityPub GET request (default: true) # Sign to ActivityPub GET request (default: true)
signToActivityPubGet: 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: [ #allowedPrivateNetworks: [
# '127.0.0.1/32' # '127.0.0.1/32'
#] #]

View file

@ -96,6 +96,7 @@ export type Source = {
videoThumbnailGenerator?: string; videoThumbnailGenerator?: string;
signToActivityPubGet?: boolean; signToActivityPubGet?: boolean;
outboxNotesFetchLimit?: number;
}; };
/** /**

View file

@ -638,6 +638,8 @@ export class ApPersonService implements OnModuleInit {
* This only retrieves the first page for now. * This only retrieves the first page for now.
*/ */
public async updateOutboxFirstPage(user: RemoteUser, outbox: IActor['outbox'], resolver: Resolver): Promise<void> { public async updateOutboxFirstPage(user: RemoteUser, outbox: IActor['outbox'], resolver: Resolver): Promise<void> {
if (!this.config.outboxNotesFetchLimit) return;
// https://www.w3.org/TR/activitypub/#actor-objects // https://www.w3.org/TR/activitypub/#actor-objects
// Outbox is a required property for all actors // Outbox is a required property for all actors
if (!outbox) { if (!outbox) {
@ -655,8 +657,8 @@ export class ApPersonService implements OnModuleInit {
await resolver.resolveOrderedCollectionPage(collection.first) : await resolver.resolveOrderedCollectionPage(collection.first) :
collection; collection;
// Perform activity but only the first 20 ones with `type: Create` // Perform activity but only the first outboxNotesFetchLimit ones with `type: Create`
await this.apInboxService.performActivity(user, firstPage, { limit: 20, allow: ['Create'] }); await this.apInboxService.performActivity(user, firstPage, { limit: this.config.outboxNotesFetchLimit, allow: ['Create'] });
} }
/** /**