From 284b87dae85a356dd543a03f81d12031b11f7554 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 2 Mar 2026 16:05:12 -0500 Subject: split url into webUrl and localUrl (like mastodon) --- packages/backend/src/server/ActivityPubServerService.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/backend/src/server/ActivityPubServerService.ts') diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index 27d25d2152..9a8309b41c 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -114,7 +114,7 @@ export class ActivityPubServerService { private async packActivity(note: MiNote, author: MiUser): Promise { if (isRenote(note) && !isQuote(note)) { const renote = await this.notesRepository.findOneByOrFail({ id: note.renoteId }); - return this.apRendererService.renderAnnounce(renote.uri ? renote.uri : `${this.config.url}/notes/${renote.id}`, note); + return this.apRendererService.renderAnnounce(renote.uri ? renote.uri : `${this.config.webUrl}/notes/${renote.id}`, note); } return this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, author, false), note); @@ -196,7 +196,7 @@ export class ActivityPubServerService { const logPrefix = `${request.id} ${request.url} (by ${request.headers['user-agent']}) claims to be from ${keyHost}:`; - if (signature.params.headers.indexOf('host') === -1 || request.headers.host !== this.config.host) { + if (signature.params.headers.indexOf('host') === -1 || (request.headers.host !== this.config.localHost && request.headers.host !== this.config.webHost)) { // no destination host, or not us: refuse return `${logPrefix} no destination host, or not us: refuse`; } @@ -292,7 +292,7 @@ export class ActivityPubServerService { } if (signature.params.headers.indexOf('host') === -1 - || request.headers.host !== this.config.host) { + || (request.headers.host !== this.config.localHost && request.headers.host !== this.config.webHost)) { // Host not specified or not match. reply.code(401); return; @@ -394,7 +394,7 @@ export class ActivityPubServerService { //#endregion const limit = 10; - const partOf = `${this.config.url}/users/${userId}/followers`; + const partOf = `${this.config.webUrl}/users/${userId}/followers`; if (page) { const query = { @@ -491,7 +491,7 @@ export class ActivityPubServerService { //#endregion const limit = 10; - const partOf = `${this.config.url}/users/${userId}/following`; + const partOf = `${this.config.webUrl}/users/${userId}/following`; if (page) { const query = { @@ -576,7 +576,7 @@ export class ActivityPubServerService { const renderedNotes = await Promise.all(pinnedNotes.map(note => this.apRendererService.renderNote(note, user))); const rendered = this.apRendererService.renderOrderedCollection( - `${this.config.url}/users/${userId}/collections/featured`, + `${this.config.webUrl}/users/${userId}/collections/featured`, renderedNotes.length, undefined, undefined, @@ -635,7 +635,7 @@ export class ActivityPubServerService { } const limit = 20; - const partOf = `${this.config.url}/users/${userId}/outbox`; + const partOf = `${this.config.webUrl}/users/${userId}/outbox`; if (page) { const notes = this.meta.enableFanoutTimeline ? await this.fanoutTimelineEndpointService.getMiNotes({ -- cgit v1.2.3-freya