@rmdes/indiekit-endpoint-activitypub 2.11.0 → 2.11.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/index.js CHANGED
@@ -483,6 +483,7 @@ export default class ActivityPubEndpoint {
483
483
  resolvedMentions.push({
484
484
  handle,
485
485
  actorUrl: mentionedActor.id.href,
486
+ profileUrl: mentionedActor.url?.href || null,
486
487
  });
487
488
  mentionRecipients.push({
488
489
  handle,
package/lib/jf2-to-as2.js CHANGED
@@ -60,18 +60,18 @@ export function parseMentions(text) {
60
60
 
61
61
  /**
62
62
  * Replace @user@domain patterns in HTML with linked mentions.
63
- * resolvedMentions: [{ handle, actorUrl }]
64
- * Unresolved handles get a WebFinger-style link as fallback.
63
+ * resolvedMentions: [{ handle, actorUrl, profileUrl? }]
64
+ * Uses profileUrl (human-readable) for href, falls back to Mastodon-style URL.
65
65
  */
66
66
  function linkifyMentions(html, resolvedMentions) {
67
67
  if (!html || !resolvedMentions?.length) return html;
68
- for (const { handle, actorUrl } of resolvedMentions) {
68
+ for (const { handle, profileUrl } of resolvedMentions) {
69
69
  // Escape handle for regex (dots, hyphens)
70
70
  const escaped = handle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
71
71
  // Match @handle not already inside an HTML tag attribute or anchor text
72
72
  const pattern = new RegExp(`(?<!["\\/\\w])@${escaped}(?![\\w])`, "gi");
73
73
  const parts = handle.split("@");
74
- const url = actorUrl || `https://${parts[1]}/@${parts[0]}`;
74
+ const url = profileUrl || `https://${parts[1]}/@${parts[0]}`;
75
75
  html = html.replace(
76
76
  pattern,
77
77
  `<a href="${url}" class="mention" rel="nofollow noopener" target="_blank">@${handle}</a>`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.11.0",
3
+ "version": "2.11.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",