Changeset 2923a95 in Klonkt
- Timestamp:
- 06/25/2026 05:57:01 AM (3 months ago)
- Branches:
- main
- Children:
- 30271e6
- Parents:
- ca25f360
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rca25f360 r2923a95 116 116 return ({ jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif' })[(e || '').toLowerCase()] || 'image/jpeg'; 117 117 }; 118 const hadAudio = /\[\[(track|album|playlist):/i.test(post.content || ''); 118 119 const urls = []; 119 if (post.cover_image_url) urls.push(abs(post.cover_image_url)); 120 // Audio posts suppress image attachments so Mastodon renders the player CARD 121 // (twitter:player) instead of the cover — on Mastodon a media attachment and a 122 // link/player card are mutually exclusive, and the inline player is the point. 123 if (post.cover_image_url && !hadAudio) urls.push(abs(post.cover_image_url)); 120 124 let body = post.content || ''; 121 for (const m of body.matchAll(/<img\b[^>]*\bsrc="([^"]+)"[^>]*>/gi)) urls.push(abs(m[1]));125 if (!hadAudio) for (const m of body.matchAll(/<img\b[^>]*\bsrc="([^"]+)"[^>]*>/gi)) urls.push(abs(m[1])); 122 126 body = body.replace(/<img\b[^>]*>/gi, ''); 123 127 // Audio shortcodes: do NOT federate the raw audio file — Klonkt deliberately … … 132 136 for (const m of body.matchAll(/\[\[album:([^\]]+)\]\]/g)) audioLabels.push(m[1].trim()); 133 137 } catch { /* non-fatal */ } 134 const hadAudio = /\[\[(track|album|playlist):/i.test(body);135 138 body = body.replace(/\[\[(track|album|playlist):[^\]]+\]\]/gi, ''); 136 139 if (hadAudio) {
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)