From eaa13156f501e8e7e935b29e21bd68cea5db0b47 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 24 Oct 2024 18:10:14 -0300 Subject: [PATCH] fix: inbox and outbox content types --- src/server/api/inbox.ts | 10 +++++----- src/server/api/outbox.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/api/inbox.ts b/src/server/api/inbox.ts index a09dac5..b2dcc9b 100644 --- a/src/server/api/inbox.ts +++ b/src/server/api/inbox.ts @@ -51,7 +51,7 @@ export const inboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPubS id: `${cfg.publicURL}${request.url}`, first: `${cfg.publicURL}/v1/${actor}/inbox?limit=100` } - return await reply.send(inbox) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(inbox) } skip ??= 0 @@ -68,7 +68,7 @@ export const inboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPubS next, orderedItems } - return await reply.send(orderedCollectionPage) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(orderedCollectionPage) }) // This is what instances will POST to in order to notify of follows/replies/etc @@ -145,7 +145,7 @@ export const inboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPubS const collection = await apsystem.repliesCollection(actor, replyURL, to) - return await reply.send(collection) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(collection) }) // TODO: Paging? @@ -179,7 +179,7 @@ export const inboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPubS const collection = await apsystem.likesCollection(actor, objectURL, !allowed) - return await reply.send(collection) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(collection) }) // TODO: Paging? @@ -213,7 +213,7 @@ export const inboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPubS const collection = await apsystem.sharesCollection(actor, objectURL, !allowed) - return await reply.send(collection) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(collection) }) // Deny a follow request/boost/etc // The ID is the URL encoded id from the inbox activity diff --git a/src/server/api/outbox.ts b/src/server/api/outbox.ts index 9cbb97d..50cbc25 100644 --- a/src/server/api/outbox.ts +++ b/src/server/api/outbox.ts @@ -76,6 +76,6 @@ export const outboxRoutes = (cfg: APIConfig, store: Store, apsystem: ActivityPub const activity = await apsystem.getOutboxItem(actor, id) - return await reply.send(activity) + return await reply.headers({ 'Content-Type': 'application/activity+json' }).send(activity) }) }