@rmdes/indiekit-endpoint-activitypub 1.0.14 → 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/batch-refollow.js +17 -8
- package/lib/inbox-listeners.js +5 -5
- package/package.json +1 -1
package/lib/batch-refollow.js
CHANGED
|
@@ -233,23 +233,32 @@ async function processOneFollow(options, entry) {
|
|
|
233
233
|
throw new Error("Could not resolve remote actor");
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
//
|
|
236
|
+
// Use the canonical actor URL (may differ from imported URL)
|
|
237
|
+
const canonicalUrl = remoteActor.id?.href || entry.actorUrl;
|
|
238
|
+
|
|
239
|
+
// Send Follow activity using canonical URL
|
|
237
240
|
const follow = new Follow({
|
|
238
241
|
actor: ctx.getActorUri(handle),
|
|
239
|
-
object: new URL(
|
|
242
|
+
object: new URL(canonicalUrl),
|
|
240
243
|
});
|
|
241
244
|
|
|
242
245
|
await ctx.sendActivity({ identifier: handle }, remoteActor, follow);
|
|
243
246
|
|
|
244
|
-
// Mark as sent
|
|
247
|
+
// Mark as sent — update actorUrl to canonical form so Accept handler
|
|
248
|
+
// can match when the remote server responds
|
|
249
|
+
const updateFields = {
|
|
250
|
+
source: "refollow:sent",
|
|
251
|
+
refollowLastAttempt: new Date().toISOString(),
|
|
252
|
+
refollowError: null,
|
|
253
|
+
};
|
|
254
|
+
if (canonicalUrl !== entry.actorUrl) {
|
|
255
|
+
updateFields.actorUrl = canonicalUrl;
|
|
256
|
+
}
|
|
257
|
+
|
|
245
258
|
await collections.ap_following.updateOne(
|
|
246
259
|
{ _id: entry._id },
|
|
247
260
|
{
|
|
248
|
-
$set:
|
|
249
|
-
source: "refollow:sent",
|
|
250
|
-
refollowLastAttempt: new Date().toISOString(),
|
|
251
|
-
refollowError: null,
|
|
252
|
-
},
|
|
261
|
+
$set: updateFields,
|
|
253
262
|
$inc: { refollowAttempts: 1 },
|
|
254
263
|
},
|
|
255
264
|
);
|
package/lib/inbox-listeners.js
CHANGED
|
@@ -120,15 +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
|
-
const inner = await accept.getObject();
|
|
129
|
-
if (!(inner instanceof Follow)) return;
|
|
130
|
-
|
|
131
|
-
// Match against our following list for refollow or microsub-reader follows
|
|
132
132
|
const result = await collections.ap_following.findOneAndUpdate(
|
|
133
133
|
{
|
|
134
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",
|