@rmdes/indiekit-endpoint-activitypub 3.8.0 → 3.8.2

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/index.js CHANGED
@@ -238,6 +238,21 @@ export default class ActivityPubEndpoint {
238
238
  console.info(`[federation-diag] POST ${req.path} from=${ua.slice(0, 60)} bodyParsed=${bodyParsed} readable=${req.readable}`);
239
239
  }
240
240
 
241
+ // Fedify's acceptsJsonLd() treats Accept: */* as NOT accepting JSON-LD
242
+ // (it only returns true for explicit application/activity+json etc.).
243
+ // Remote servers fetching actor URLs for HTTP Signature verification
244
+ // (e.g. tags.pub) often omit Accept or use */* — they get HTML back
245
+ // instead of the actor JSON, causing "public key not found" errors.
246
+ // Fix: for GET requests to actor paths, upgrade ambiguous Accept headers
247
+ // to application/activity+json so Fedify serves JSON-LD. Explicit
248
+ // text/html requests (browsers) are unaffected.
249
+ if (req.method === "GET" && /^\/users\/[^/]+\/?$/.test(req.path)) {
250
+ const accept = req.get("accept") || "";
251
+ if (!accept.includes("text/html") && !accept.includes("application/xhtml+xml")) {
252
+ req.headers["accept"] = "application/activity+json";
253
+ }
254
+ }
255
+
241
256
  return self._fedifyMiddleware(req, res, next);
242
257
  });
243
258
 
@@ -764,7 +779,7 @@ export default class ActivityPubEndpoint {
764
779
  (remoteActor.icon
765
780
  ? (await remoteActor.icon)?.url?.href || ""
766
781
  : "");
767
- const inbox = remoteActor.inbox?.id?.href || "";
782
+ const inbox = remoteActor.inboxId?.href || "";
768
783
  const sharedInbox = remoteActor.endpoints?.sharedInbox?.href || "";
769
784
 
770
785
  await this._collections.ap_following.updateOne(
@@ -87,7 +87,7 @@ export async function isTagFollowed(collections, tag) {
87
87
  if (!ap_followed_tags) return false;
88
88
  const normalizedTag = tag.toLowerCase().trim().replace(/^#/, "");
89
89
  const doc = await ap_followed_tags.findOne({ tag: normalizedTag });
90
- return !!doc;
90
+ return !!(doc?.followedAt);
91
91
  }
92
92
 
93
93
  /**
@@ -96,7 +96,7 @@ export async function isTagFollowed(collections, tag) {
96
96
  * @returns {string} Actor URL
97
97
  */
98
98
  export function getTagsPubActorUrl(tag) {
99
- return `https://tags.pub/user/${tag.toLowerCase()}`;
99
+ return `https://tags.pub/user/${tag.toLowerCase().replace(/^#/, "")}`;
100
100
  }
101
101
 
102
102
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "3.8.0",
3
+ "version": "3.8.2",
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",
@@ -81,7 +81,7 @@
81
81
  </nav>
82
82
  {% endif %}
83
83
 
84
- {# Infinite scroll sentinel (Task 5) #}
84
+ {# Infinite scroll load-more trigger #}
85
85
  {% if before %}
86
86
  <div class="ap-load-more"
87
87
  id="ap-load-more"