Changeset 4424af7 in Klonkt
- Timestamp:
- 07/16/2026 12:20:51 PM (8 weeks ago)
- Branches:
- main
- Children:
- df9da7d
- Parents:
- ae05747
- git-author:
- Robin <roboburr@…> (07/12/2026 10:41:10 PM)
- git-committer:
- Robin <roboburr@…> (07/16/2026 12:20:51 PM)
- Location:
- src
- Files:
-
- 2 edited
-
routes/posts.js (modified) (1 diff)
-
services/ActivityPubService.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
rae05747 r4424af7 1070 1070 html = html.replace(/\[\[(track|album|playlist):[^\]]+\]\]/gi, ''); 1071 1071 } 1072 // Linkify inline #hashtags and bare URLs for on-site display — same rules as the 1073 // federated copy (buildNote). Was: only the Mastodon copy got links; the website 1074 // showed raw "#tag"/URL text. Idempotent, so editor links + embeds are untouched. 1075 html = ActivityPubService.linkifyBody('', html); 1072 1076 post.content_html = html; 1073 1077 -
src/services/ActivityPubService.js
rae05747 r4424af7 1422 1422 return parts.join(''); 1423 1423 } 1424 // Linkify inline #hashtags and bare URLs in BODY html for on-site DISPLAY, using the 1425 // EXACT same rules as the federated copy (linkHashtags/linkUrls), so the website and the 1426 // Mastodon copy agree instead of the website showing raw text. Idempotent: existing 1427 // <a>…</a> (editor links, embeds, shortcode buttons) are split out and left untouched, so 1428 // nothing is double-wrapped. Pass base='' → root-relative /tag/<slug> links. 1429 export function linkifyBody(base, html) { 1430 const withTags = String(html || '') 1431 .split(/(<a\b[^>]*>[\s\S]*?<\/a>)/gi) 1432 .map((seg) => (/^<a\b/i.test(seg) ? seg : linkHashtags(base, seg))) 1433 .join(''); 1434 return linkUrls(withTags); 1435 } 1436 1424 1437 // Extract the AP Hashtag tag objects from already-linked reply content. 1425 1438 function hashtagTags(base, content) { … … 2421 2434 deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker, 2422 2435 getReplyUris, markNotificationsSeen, countUnseenNotifications, hasPlayableAudio, 2436 linkifyBody, 2423 2437 };
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)