mirror of
https://github.com/svemagie/indiekit-endpoint-activitypub.git
synced 2026-04-02 15:44:58 +02:00
Fedify 2.1.0 upgrade: - Upgrade @fedify/fedify, @fedify/redis, @fedify/debugger to ^2.1.0 - Remove as:Endpoints type-stripping workaround (fixed upstream, fedify#576) - Wire onUnverifiedActivity handler for Delete from actors with gone keys FEP implementations: - FEP-5feb: Add indexable + discoverable to actor (search indexing consent) - FEP-f1d5/0151: Enrich NodeInfo 2.1 with metadata, staff accounts, repo info - FEP-4f05: Soft delete with Tombstone — deleted posts serve 410 + Tombstone JSON-LD with formerType, published, deleted timestamps. New ap_tombstones collection + lib/storage/tombstones.js - FEP-3b86: Activity Intents — WebFinger links for Follow/Create/Like/Announce intents, authorize_interaction routes by intent parameter - FEP-8fcf: Collection Sync outbound via Fedify syncCollection (documented that receiving side is not yet implemented)
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
/**
|
|
* Tombstone storage for soft-deleted posts (FEP-4f05).
|
|
* When a post is deleted, a tombstone record is created so remote servers
|
|
* fetching the URL get a proper Tombstone response instead of 404.
|
|
* @module storage/tombstones
|
|
*/
|
|
|
|
/**
|
|
* Record a tombstone for a deleted post.
|
|
* @param {object} collections - MongoDB collections
|
|
* @param {object} data - { url, formerType, published, deleted }
|
|
*/
|
|
export async function addTombstone(collections, { url, formerType, published, deleted }) {
|
|
const { ap_tombstones } = collections;
|
|
if (!ap_tombstones) return;
|
|
|
|
await ap_tombstones.updateOne(
|
|
{ url },
|
|
{
|
|
$set: {
|
|
url,
|
|
formerType: formerType || "Note",
|
|
published: published || null,
|
|
deleted: deleted || new Date().toISOString(),
|
|
},
|
|
},
|
|
{ upsert: true },
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Remove a tombstone (post re-published).
|
|
* @param {object} collections - MongoDB collections
|
|
* @param {string} url - Post URL
|
|
*/
|
|
export async function removeTombstone(collections, url) {
|
|
const { ap_tombstones } = collections;
|
|
if (!ap_tombstones) return;
|
|
await ap_tombstones.deleteOne({ url });
|
|
}
|
|
|
|
/**
|
|
* Look up a tombstone by URL.
|
|
* @param {object} collections - MongoDB collections
|
|
* @param {string} url - Post URL
|
|
* @returns {Promise<object|null>} Tombstone record or null
|
|
*/
|
|
export async function getTombstone(collections, url) {
|
|
const { ap_tombstones } = collections;
|
|
if (!ap_tombstones) return null;
|
|
return ap_tombstones.findOne({ url });
|
|
}
|