Changeset a9da2c0 in Klonkt
- Timestamp:
- 07/30/2026 09:32:40 AM (6 weeks ago)
- Branches:
- main
- Children:
- 67f7150
- Parents:
- d3a1abd
- Files:
-
- 3 edited
-
src/routes/activitypub.js (modified) (2 diffs)
-
src/services/ActivityPubService.js (modified) (1 diff)
-
test/c2s-compose.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
rd3a1abd ra9da2c0 106 106 const fanClause = audience === 'friend' ? '' : "AND (fan_only IS NULL OR fan_only = 0)"; 107 107 const posts = db.prepare( 108 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at108 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, c2s_attachments, published_at, created_at 109 109 FROM posts WHERE site_id = ? AND status = 'published' ${fanClause} 110 110 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20` … … 410 410 // rank 1 last) → Mastodon flips it back to pin-rank ascending on the profile. 411 411 const posts = db.prepare( 412 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at412 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, c2s_attachments, published_at, created_at 413 413 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0) 414 414 AND pinned IS NOT NULL AND pinned > 0 -
src/services/ActivityPubService.js
rd3a1abd ra9da2c0 1921 1921 if (!site) return; 1922 1922 const recent = db.prepare( 1923 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at1923 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, c2s_attachments, published_at, created_at 1924 1924 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0) 1925 1925 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20` -
test/c2s-compose.test.js
rd3a1abd ra9da2c0 117 117 }); 118 118 119 test('the OUTBOX serves the attachment too, not only the delivered Create', async () => { 120 // Root of the broken iPhone player (Robins schermafdrukken, 30-7): the 121 // outbox SELECT did not include c2s_attachments, so a note pulled via the 122 // outbox (backfill, boiert.eu) had NO Video attachment and readers fell 123 // back to the content tag with its relative, dead src. The delivered copy 124 // was fine, which is why one device worked and the other did not. This 125 // locks the outbox contract: the same narrow SELECT, through buildNote, 126 // must carry the attachment. 127 const r = await AP.ingestOutboxActivity(site, user, { 128 type: 'Create', 129 object: { 130 type: 'Note', content: '<p>buiten</p>', 131 to: ['https://test.example/ap/users/kid/followers'], 132 cc: ['https://www.w3.org/ns/activitystreams#Public'], 133 attachment: [{ type: 'Video', url: '/media/reply-media/buiten.mp4', mediaType: 'video/mp4' }], 134 }, 135 }); 136 const row = db.prepare( 137 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, c2s_attachments, published_at, created_at 138 FROM posts WHERE id = ?`).get(r.id); 139 const note = AP.buildNote('https://test.example', site, row); 140 const vid = (note.attachment || []).find((a) => a.url.endsWith('buiten.mp4')); 141 assert.ok(vid, 'the outbox-shaped row still yields the Video attachment'); 142 assert.equal(vid.type, 'Video'); 143 assert.ok(!/<video\b/i.test(note.content), 'and the content stays clean'); 144 }); 145 119 146 test('a media-only post is a post, not an empty-note error', async () => { 120 147 const r = await AP.ingestOutboxActivity(site, user, {
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)