diff --git a/lib/syndicator.js b/lib/syndicator.js index b7f9320..9946927 100644 --- a/lib/syndicator.js +++ b/lib/syndicator.js @@ -225,6 +225,15 @@ export function createSyndicator(plugin) { try { const profile = await plugin._collections.ap_profile?.findOne({}); const content = buildTimelineContent(properties); + + // Append permalink to ALL post types so the Mastodon API timeline + // matches what fediverse users see via federation (jf2-to-as2 appends it too). + if (properties.url) { + const esc = (s) => String(s).replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); + content.text = `${content.text}\n\n\u{1F517} ${properties.url}`; + content.html = `${content.html}\n
\u{1F517} ${esc(properties.url)}
`; + } + const timelineItem = { uid: properties.url, url: properties.url, @@ -344,19 +353,9 @@ function buildTimelineContent(properties) { }; } - // Regular post — append permalink to match federated AS2 content. - // Without this, the Mastodon API timeline entry lacks the link back - // to the source post that fediverse users see via federation. + // Regular post — return body content as-is. + // Permalink is appended by the caller (syndicator) for ALL post types. if (bodyText || bodyHtml) { - const postUrl = properties.url; - if (postUrl) { - const linkText = `\n\n\u{1F517} ${postUrl}`; - const linkHtml = `\u{1F517} ${esc(postUrl)}
`; - return { - text: `${bodyText}${linkText}`, - html: `${bodyHtml}\n${linkHtml}`, - }; - } return { text: bodyText, html: bodyHtml }; } diff --git a/package.json b/package.json index 057750d..527174d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "3.12.0", + "version": "3.12.1", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",