@rmdes/indiekit-endpoint-activitypub 3.12.0 → 3.12.1
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/lib/syndicator.js +11 -12
- package/package.json +1 -1
package/lib/syndicator.js
CHANGED
|
@@ -225,6 +225,15 @@ 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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
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
|
+
}
|
|
236
|
+
|
|
228
237
|
const timelineItem = {
|
|
229
238
|
uid: properties.url,
|
|
230
239
|
url: properties.url,
|
|
@@ -344,19 +353,9 @@ function buildTimelineContent(properties) {
|
|
|
344
353
|
};
|
|
345
354
|
}
|
|
346
355
|
|
|
347
|
-
// Regular post —
|
|
348
|
-
//
|
|
349
|
-
// to the source post that fediverse users see via federation.
|
|
356
|
+
// Regular post — return body content as-is.
|
|
357
|
+
// Permalink is appended by the caller (syndicator) for ALL post types.
|
|
350
358
|
if (bodyText || bodyHtml) {
|
|
351
|
-
const postUrl = properties.url;
|
|
352
|
-
if (postUrl) {
|
|
353
|
-
const linkText = `\n\n\u{1F517} ${postUrl}`;
|
|
354
|
-
const linkHtml = `<p>\u{1F517} <a href="${esc(postUrl)}">${esc(postUrl)}</a></p>`;
|
|
355
|
-
return {
|
|
356
|
-
text: `${bodyText}${linkText}`,
|
|
357
|
-
html: `${bodyHtml}\n${linkHtml}`,
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
359
|
return { text: bodyText, html: bodyHtml };
|
|
361
360
|
}
|
|
362
361
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rmdes/indiekit-endpoint-activitypub",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.1",
|
|
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",
|