@rmdes/indiekit-endpoint-activitypub 2.15.1 → 2.15.3

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/README.md CHANGED
@@ -339,6 +339,23 @@ Mastodon's `update_account_fields` checks `attachment.is_a?(Array)` and silently
339
339
 
340
340
  **Revisit when:** Fedify adds an option to preserve arrays during JSON-LD serialization, or Mastodon fixes their array check.
341
341
 
342
+ ### Endpoints `as:Endpoints` Type Stripping
343
+
344
+ **File:** `lib/federation-bridge.js` (in `sendFedifyResponse()`)
345
+ **Upstream issue:** [fedify#576](https://github.com/fedify-dev/fedify/issues/576) — FIXED in Fedify 2.1.0
346
+
347
+ Fedify serializes the `endpoints` object with `"type": "as:Endpoints"`, which is not a valid ActivityStreams type. browser.pub rejects this. The bridge strips the `type` field from the `endpoints` object before sending.
348
+
349
+ **Remove when:** Upgrading to Fedify ≥ 2.1.0.
350
+
351
+ ### PropertyValue Attachment Type (Known Issue)
352
+
353
+ **Upstream issue:** [fedify#629](https://github.com/fedify-dev/fedify/issues/629) — OPEN
354
+
355
+ Fedify serializes `PropertyValue` attachments (used by Mastodon for profile metadata fields) with `"type": "PropertyValue"`, a schema.org type that is not a valid AS2 Object or Link. browser.pub rejects `/attachment` as invalid. However, every Mastodon-compatible server emits `PropertyValue` — removing it would break profile field display across the fediverse.
356
+
357
+ **No workaround applied.** This is a de facto fediverse standard despite not being in the AS2 vocabulary.
358
+
342
359
  ### `.authorize()` Not Chained on Actor Dispatcher
343
360
 
344
361
  **File:** `lib/federation-setup.js` (line ~254)
package/index.js CHANGED
@@ -434,7 +434,7 @@ export default class ActivityPubEndpoint {
434
434
  "properties.url": requestUrl,
435
435
  });
436
436
 
437
- if (!post) {
437
+ if (!post || post.properties?.deleted) {
438
438
  return next();
439
439
  }
440
440
 
@@ -89,6 +89,12 @@ async function sendFedifyResponse(res, response, request) {
89
89
  if (json.attachment && !Array.isArray(json.attachment)) {
90
90
  json.attachment = [json.attachment];
91
91
  }
92
+ // WORKAROUND: Fedify serializes endpoints with "type": "as:Endpoints"
93
+ // which is not a valid AS2 type. The endpoints object should be a plain
94
+ // object with just sharedInbox/proxyUrl etc. Strip the invalid type.
95
+ if (json.endpoints && json.endpoints.type) {
96
+ delete json.endpoints.type;
97
+ }
92
98
  const patched = JSON.stringify(json);
93
99
  res.setHeader("content-length", Buffer.byteLength(patched));
94
100
  res.end(patched);
@@ -609,10 +609,11 @@ function setupOutbox(federation, mountPath, handle, collections) {
609
609
 
610
610
  const pageSize = 20;
611
611
  const skip = cursor ? Number.parseInt(cursor, 10) : 0;
612
- const total = await postsCollection.countDocuments();
612
+ const notDeleted = { "properties.deleted": { $exists: false } };
613
+ const total = await postsCollection.countDocuments(notDeleted);
613
614
 
614
615
  const posts = await postsCollection
615
- .find()
616
+ .find(notDeleted)
616
617
  .sort({ "properties.published": -1 })
617
618
  .skip(skip)
618
619
  .limit(pageSize)
@@ -644,7 +645,9 @@ function setupOutbox(federation, mountPath, handle, collections) {
644
645
  if (identifier !== handle) return 0;
645
646
  const postsCollection = collections.posts;
646
647
  if (!postsCollection) return 0;
647
- return await postsCollection.countDocuments();
648
+ return await postsCollection.countDocuments({
649
+ "properties.deleted": { $exists: false },
650
+ });
648
651
  })
649
652
  .setFirstCursor(async () => "0");
650
653
  }
@@ -656,6 +659,8 @@ function setupObjectDispatchers(federation, mountPath, handle, collections, publ
656
659
  const postUrl = `${publicationUrl.replace(/\/$/, "")}/${id}`;
657
660
  const post = await collections.posts.findOne({ "properties.url": postUrl });
658
661
  if (!post) return null;
662
+ // Soft-deleted posts should not be dereferenceable
663
+ if (post.properties?.deleted) return null;
659
664
  const actorUrl = ctx.getActorUri(handle).href;
660
665
  const activity = jf2ToAS2Activity(post.properties, actorUrl, publicationUrl);
661
666
  // Only Create activities wrap Note/Article objects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.15.1",
3
+ "version": "2.15.3",
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",