From e011a2ce3e43c87fec3ae19ef9b6d81917631a92 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:05:36 +1000 Subject: content type --- src/activitypub/Server.ts | 7 +++++++ src/activitypub/webfinger/index.ts | 1 + 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/activitypub/Server.ts b/src/activitypub/Server.ts index 492d43b6..c497d2e6 100644 --- a/src/activitypub/Server.ts +++ b/src/activitypub/Server.ts @@ -50,6 +50,13 @@ export class APServer extends Server { this.app = app; + this.app.use("*", (req, res, next) => { + res.setHeader( + "Content-Type", + "application/activity+json; charset=utf-8", + ); + next(); + }); this.app.use("/fed", api); this.app.get("/fed", (req, res) => { res.json({ ping: "pong" }); diff --git a/src/activitypub/webfinger/index.ts b/src/activitypub/webfinger/index.ts index 0b82e103..f1b49624 100644 --- a/src/activitypub/webfinger/index.ts +++ b/src/activitypub/webfinger/index.ts @@ -48,6 +48,7 @@ router.get( const type = found instanceof Channel ? "channel" : "user"; + res.setHeader("Content-Type", "application/jrd+json; charset=utf-8"); return res.json({ subject: `acct:${resourceId}@${webDomain}`, // mastodon always returns acct so might as well aliases: [`https://${webDomain}/fed/${type}/${resourceId}`], -- cgit 1.5.1