@rmdes/indiekit-endpoint-activitypub 2.15.2 → 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/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
 
@@ -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.2",
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",