From 0e054e7cbacfa1abd2f6fc68d8934284eb824533 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 17 Jul 2024 15:08:21 +0200 Subject: [PATCH] fix(federation): :bug: Put the ActivityPub link first in WebFinger to work around Misskey bug --- bun.lockb | Bin 261148 -> 261148 bytes package.json | 2 +- server/api/well-known/webfinger/index.ts | 13 ++++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bun.lockb b/bun.lockb index 04dce4cef795bfcadd4039f43a2680b9a4a5689f..3e4fe9972495e62f63219e775a57b1aa9dd78c05 100755 GIT binary patch delta 153 zcmV;K0A~N3_z#@;50EY(S4>RNcKOXGrC;UTsmZTQp>;{lv-w_Z|rjDz`cgd6%5 zcPHjg%imbin2Ri+f!UsVVoG6w-4ciWSOK^FSOQE+0W-HsqXN?9mom-+A(ue&0|vK4 Hi38bkETu|z delta 153 zcmV;K0A~N3_z#@;50EY(rcCvJm6f)VE3F%I>HHoc`MWlAg%$ITUacS?V$_Y;u}%tf zlNc&6vxsyxUxL$SOK^FSOQE+0W!BrqXN?9m*rvuAeT^90|>W7 Hi38Yjd activityPubUrl = await manager.webFinger( user.data.username, new URL(config.http.base_url).host, + "application/activity+json", ); } catch (e) { const error = e as ResponseError; @@ -111,6 +112,13 @@ export default (app: Hono) => }@${host}`, links: [ + // Keep the ActivityPub link first, because Misskey only searches + // for the first link with rel="self" and doesn't check the type. + activityPubUrl && { + rel: "self", + type: "application/activity+json", + href: activityPubUrl, + }, { rel: "self", type: "application/json", @@ -119,11 +127,6 @@ export default (app: Hono) => config.http.base_url, ).toString(), }, - activityPubUrl && { - rel: "self", - type: "application/activity+json", - href: activityPubUrl, - }, { rel: "avatar", type: lookup(user.getAvatarUrl(config)),