Changeset 928d1c7 in Klonkt for src/services
- Timestamp:
- 07/21/2026 01:06:47 AM (7 weeks ago)
- Branches:
- main
- Children:
- 9e9e6f9
- Parents:
- 61e3daf
- git-author:
- Robin <roboburr@…> (07/21/2026 01:06:45 AM)
- git-committer:
- Robin <roboburr@…> (07/21/2026 01:06:47 AM)
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r61e3daf r928d1c7 278 278 const escTitle = String(post.title || '').replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c])); 279 279 const titleHtml = post.title ? `<p><strong>${escTitle}</strong></p>` : ''; 280 281 // Paid post (klonkt-demo-aki): federate a PUBLIC teaser + link, never the full 282 // content, so nothing leaks past the paywall. No media attachments either. 283 if (post.paid) { 284 const esc = (x) => String(x || '').replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c])); 285 const _firstP = (String(post.content || '').match(/<p[^>]*>([\s\S]*?)<\/p>/i) || [null, ''])[1] || ''; 286 const rawTeaser = String(post.excerpt || '').trim() 287 || _firstP.replace(/<[^>]+>/g, ' ').replace(/&[a-z#0-9]+;/gi, ' ').replace(/\s+/g, ' ').trim().slice(0, 280); 288 return { 289 '@context': AP_CONTEXT, 290 id, 291 type: 'Note', 292 attributedTo: aId, 293 content: `${titleHtml}<p>${esc(rawTeaser)}${rawTeaser ? '…' : ''}</p><p><a href="${human}">Lees de volledige post (supporters)</a></p>`, 294 url: human, 295 published: toISO(post.published_at || post.created_at || Date.now()), 296 to: [PUBLIC], 297 cc: [`${aId}/followers`], 298 tag: [...hashtagTags(base, post.content)], 299 replies: `${id}/replies`, 300 }; 301 } 280 302 281 303 // Images travel as AP `attachment` (Mastodon strips <img> from content). Collect
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)