@rmdes/indiekit-endpoint-activitypub 3.12.1 → 3.12.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.
@@ -99,7 +99,17 @@ export function serializeStatus(item, { baseUrl, favouritedIds, rebloggedIds, bo
99
99
  }
100
100
 
101
101
  // Regular status (note, article, question)
102
- const content = item.content?.html || item.content?.text || "";
102
+ let content = item.content?.html || item.content?.text || "";
103
+
104
+ // Append permalink for own posts at read time — matches what fediverse
105
+ // users see via federation (jf2-to-as2 appends the same link).
106
+ // Done here instead of at write time so it survives backfills and cleanups.
107
+ const isOwnPost = _localPublicationUrl && item.author?.url === _localPublicationUrl;
108
+ const postUrl = item.uid || item.url;
109
+ if (isOwnPost && postUrl && !content.includes(postUrl)) {
110
+ const escaped = postUrl.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
111
+ content += `\n<p>\u{1F517} <a href="${escaped}">${escaped}</a></p>`;
112
+ }
103
113
  const spoilerText = item.summary || "";
104
114
  const sensitive = item.sensitive || false;
105
115
  const visibility = item.visibility || "public";
package/lib/syndicator.js CHANGED
@@ -225,14 +225,7 @@ export function createSyndicator(plugin) {
225
225
  try {
226
226
  const profile = await plugin._collections.ap_profile?.findOne({});
227
227
  const content = buildTimelineContent(properties);
228
-
229
- // Append permalink to ALL post types so the Mastodon API timeline
230
- // matches what fediverse users see via federation (jf2-to-as2 appends it too).
231
- if (properties.url) {
232
- const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
233
- content.text = `${content.text}\n\n\u{1F517} ${properties.url}`;
234
- content.html = `${content.html}\n<p>\u{1F517} <a href="${esc(properties.url)}">${esc(properties.url)}</a></p>`;
235
- }
228
+ // Permalink is appended at read time by serializeStatus, not here.
236
229
 
237
230
  const timelineItem = {
238
231
  uid: properties.url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "3.12.1",
3
+ "version": "3.12.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",