fix: Accept handler skipping all accepts due to inner object type
Fedify resolves accept.getObject() to a Person (the Follow target actor) rather than the Follow activity itself. The instanceof Follow check rejected every Accept. Removed inner object inspection entirely — instead match directly against ap_following where source is refollow:sent. If we have a pending follow for this actor, any Accept from them confirms it.
This commit is contained in:
+5
-20
@@ -120,30 +120,15 @@ export function registerInboxListeners(inboxChain, options) {
|
||||
}
|
||||
})
|
||||
.on(Accept, async (ctx, accept) => {
|
||||
// Handle Accept(Follow) — remote server accepted our Follow request
|
||||
// Handle Accept(Follow) — remote server accepted our Follow request.
|
||||
// We don't inspect the inner object type because Fedify often resolves
|
||||
// it to a Person (the Follow's target) rather than the Follow itself.
|
||||
// Instead, we match directly against ap_following — if we have a
|
||||
// pending follow for this actor, any Accept from them confirms it.
|
||||
const actorObj = await accept.getActor();
|
||||
const actorUrl = actorObj?.id?.href || "";
|
||||
if (!actorUrl) return;
|
||||
|
||||
// Check if the inner object is a Follow. Some servers send the full
|
||||
// Follow object, others send only a reference URL that Fedify can't
|
||||
// resolve (since the original Follow was our outgoing activity).
|
||||
let isFollow = false;
|
||||
try {
|
||||
const inner = await accept.getObject();
|
||||
isFollow = inner instanceof Follow;
|
||||
// If inner resolved to a non-Follow activity, skip
|
||||
if (inner && !isFollow) {
|
||||
console.info(
|
||||
`[ActivityPub] Accept from ${actorUrl}: inner is ${inner.constructor?.name}, not Follow — skipping`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// getObject() failed — proceed anyway if we have a pending follow
|
||||
}
|
||||
|
||||
// Match against our following list for refollow or microsub-reader follows
|
||||
const result = await collections.ap_following.findOneAndUpdate(
|
||||
{
|
||||
actorUrl,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16",
|
||||
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
||||
"keywords": [
|
||||
"indiekit",
|
||||
|
||||
Reference in New Issue
Block a user