Changeset 2a10445 in Klonkt for src/services
- Timestamp:
- 07/30/2026 08:23:47 AM (6 weeks ago)
- Branches:
- main
- Children:
- 094f7d0
- Parents:
- 15f1cb5
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r15f1cb5 r2a10445 2410 2410 return `<p><video controls playsinline preload="metadata"${poster} src="${a.url}"></video></p>`; 2411 2411 }).join(''); 2412 // The web tile (Robins aanwijzing, 30-7): a video post's first video2413 // becomes the cover video, so the grid plays it muted-looping as its own2414 // thumbnail, exactly like an animated cover. Deliberately NO cover image2415 // next to it: the tile's image branch would win and freeze the tile. A2416 // photo post gets its first image as cover, instead of the (untitled)2417 // gradient.2418 const coverVid = media.find((a) => a.mediaType.startsWith('video/'));2419 const coverImg = media.find((a) => a.mediaType.startsWith('image/'));2420 2412 const postId = crypto.randomUUID(); 2421 2413 const slug = 'n-' + postId.slice(0, 8); … … 2428 2420 const vis = c2sVisibility(object); 2429 2421 const fanOnly = (vis === 'friends' || vis === 'direct') ? 1 : 0; 2430 db.prepare(`INSERT INTO posts (id, site_id, slug, author_id, title, content, excerpt, status, type, language, fan_only, ap_visibility, cover_image_url, cover_video_url, created_at, updated_at, published_at) 2431 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`) 2432 .run(postId, site.id, slug, user.id, '', html + mediaHtml, '', 'published', 'post', object.language || 'nl', fanOnly, vis, 2433 coverVid ? null : (coverImg ? coverImg.url : null), coverVid ? coverVid.url : null, now, now, now); 2422 // Deliberately NO cover (Robins besluit, 30-7): the media lives in the 2423 // content, and a cover next to it showed the same video twice on the post 2424 // page. The tiles derive their picture from the content instead. 2425 db.prepare(`INSERT INTO posts (id, site_id, slug, author_id, title, content, excerpt, status, type, language, fan_only, ap_visibility, created_at, updated_at, published_at) 2426 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`) 2427 .run(postId, site.id, slug, user.id, '', html + mediaHtml, '', 'published', 'post', object.language || 'nl', fanOnly, vis, now, now, now); 2434 2428 if (media.length) { try { db.prepare('UPDATE posts SET c2s_attachments = ? WHERE id = ?').run(JSON.stringify(media), postId); } catch { /* column exists via ensureColumn */ } } 2435 2429 try { db.prepare('UPDATE posts SET content_rendered = ? WHERE id = ?').run(bakePostContent(html + mediaHtml), postId); } catch { /* render fallback covers it */ } … … 2437 2431 try { db.prepare('INSERT INTO posts_fts(content, title, author, post_id) VALUES (?,?,?,?)').run(HtmlSanitizerService.toPlainText(html), '', user.username || '', postId); } catch { /* FTS non-fatal */ } 2438 2432 if (vis !== 'direct') { 2439 deliverCreate(site, { id: postId, slug, title: '', content: html + mediaHtml, published_at: now, created_at: now, fan_only: fanOnly, ap_visibility: vis, c over_image_url: coverVid ? null : (coverImg ? coverImg.url : null), cover_video_url: coverVid ? coverVid.url : null, c2s_attachments: media.length ? JSON.stringify(media) : null }).catch(() => { /* best-effort */ });2433 deliverCreate(site, { id: postId, slug, title: '', content: html + mediaHtml, published_at: now, created_at: now, fan_only: fanOnly, ap_visibility: vis, c2s_attachments: media.length ? JSON.stringify(media) : null }).catch(() => { /* best-effort */ }); 2440 2434 } 2441 2435 return { status: 201, id: postId, url: `${base}/ap/notes/${postId}` };
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)