Changeset 857a06f in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/30/2026 05:43:39 PM (2 months ago)
- Branches:
- main
- Children:
- 7ecbefc
- Parents:
- b5a09ce2
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rb5a09ce2 r857a06f 222 222 const mediaType = (u) => { 223 223 const e = ((u || '').split('?')[0].match(/\.(\w+)$/) || [])[1]; 224 return ({ jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif' })[(e || '').toLowerCase()] || 'image/jpeg';224 return ({ jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif', mp4: 'video/mp4', webm: 'video/webm', mov: 'video/quicktime' })[(e || '').toLowerCase()] || 'image/jpeg'; 225 225 }; 226 226 const hadAudio = /\[\[(track|album|playlist):/i.test(post.content || ''); … … 256 256 // link/player card are mutually exclusive on Mastodon. Link-only audio (external) 257 257 // keeps its cover (no player card to show). 258 if (post.cover_image_url && !noImages) urls.push(abs(post.cover_image_url)); 258 // An animated cover federates as the muted loop MP4 (→ a Video attachment): animated WebP is 259 // unreliable on Mastodon and its iOS apps; the MP4 plays everywhere. Else the still cover image. 260 if (post.cover_video_url && !noImages) urls.push(abs(post.cover_video_url)); 261 else if (post.cover_image_url && !noImages) urls.push(abs(post.cover_image_url)); 259 262 let body = post.content || ''; 260 263 // Only federate inline images we can actually serve: absolute http(s) URLs, or our own … … 976 979 if (!site) return; 977 980 const recent = db.prepare( 978 `SELECT id, slug, title, content, cover_image_url, nsfw, content_warning, published_at, created_at981 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at 979 982 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0) 980 983 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20`
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)