@rmdes/indiekit-endpoint-activitypub 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/inbox-listeners.js +5 -20
- package/package.json +1 -1
package/lib/inbox-listeners.js
CHANGED
|
@@ -120,30 +120,15 @@ export function registerInboxListeners(inboxChain, options) {
|
|
|
120
120
|
}
|
|
121
121
|
})
|
|
122
122
|
.on(Accept, async (ctx, accept) => {
|
|
123
|
-
// Handle Accept(Follow) — remote server accepted our Follow request
|
|
123
|
+
// Handle Accept(Follow) — remote server accepted our Follow request.
|
|
124
|
+
// We don't inspect the inner object type because Fedify often resolves
|
|
125
|
+
// it to a Person (the Follow's target) rather than the Follow itself.
|
|
126
|
+
// Instead, we match directly against ap_following — if we have a
|
|
127
|
+
// pending follow for this actor, any Accept from them confirms it.
|
|
124
128
|
const actorObj = await accept.getActor();
|
|
125
129
|
const actorUrl = actorObj?.id?.href || "";
|
|
126
130
|
if (!actorUrl) return;
|
|
127
131
|
|
|
128
|
-
// Check if the inner object is a Follow. Some servers send the full
|
|
129
|
-
// Follow object, others send only a reference URL that Fedify can't
|
|
130
|
-
// resolve (since the original Follow was our outgoing activity).
|
|
131
|
-
let isFollow = false;
|
|
132
|
-
try {
|
|
133
|
-
const inner = await accept.getObject();
|
|
134
|
-
isFollow = inner instanceof Follow;
|
|
135
|
-
// If inner resolved to a non-Follow activity, skip
|
|
136
|
-
if (inner && !isFollow) {
|
|
137
|
-
console.info(
|
|
138
|
-
`[ActivityPub] Accept from ${actorUrl}: inner is ${inner.constructor?.name}, not Follow — skipping`,
|
|
139
|
-
);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
} catch {
|
|
143
|
-
// getObject() failed — proceed anyway if we have a pending follow
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Match against our following list for refollow or microsub-reader follows
|
|
147
132
|
const result = await collections.ap_following.findOneAndUpdate(
|
|
148
133
|
{
|
|
149
134
|
actorUrl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rmdes/indiekit-endpoint-activitypub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"indiekit",
|