Changeset b7d4458 in Klonkt for src/routes
- Timestamp:
- 06/27/2026 08:10:43 AM (2 months ago)
- Branches:
- main
- Children:
- c21197a
- Parents:
- 92f6976
- Location:
- src/routes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r92f6976 rb7d4458 67 67 if (!site) return res.status(404).end(); 68 68 const posts = db.prepare( 69 `SELECT id, slug, title, content, cover_image_url, nsfw, published_at, created_at69 `SELECT id, slug, title, content, cover_image_url, nsfw, content_warning, published_at, created_at 70 70 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0) 71 71 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20` … … 90 90 // rank 1 last) → Mastodon flips it back to pin-rank ascending on the profile. 91 91 const posts = db.prepare( 92 `SELECT id, slug, title, content, cover_image_url, nsfw, published_at, created_at92 `SELECT id, slug, title, content, cover_image_url, nsfw, content_warning, published_at, created_at 93 93 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0) 94 94 AND pinned IS NOT NULL AND pinned > 0 -
src/routes/circle.js
r92f6976 rb7d4458 53 53 pinned: 0, 54 54 isBoost: !!r.boosted, // a post YOU boosted → render in the pinned style with a Boost badge 55 nsfw: r.nsfw ? 1 : 0, // remote sensitive post → blur in the Cirkel (post-card/tile) 56 content_warning: r.cw || '', 55 57 status: 'published', 56 58 source_name: name, -
src/routes/posts.js
r92f6976 rb7d4458 177 177 const fanOnly = req.body.fan_only ? 1 : 0; 178 178 const nsfw = req.body.nsfw ? 1 : 0; 179 const cw = (req.body.content_warning || '').trim().slice(0, 200); 179 180 180 181 // Content arrives as user-authored HTML from the WYSIWYG editor — sanitize … … 214 215 INSERT INTO posts ( 215 216 id, site_id, slug, author_id, title, content, excerpt, 216 status, cover_image_url, pinned, tags, type, noindex, fan_only, nsfw, publish_at,217 status, cover_image_url, pinned, tags, type, noindex, fan_only, nsfw, content_warning, publish_at, 217 218 created_at, updated_at, published_at 218 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )219 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 219 220 `).run( 220 221 postId, site.id, finalSlug, req.session.user.id, … … 222 223 finalStatus, cover_image_url || null, parsePinnedRank(pinned), 223 224 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 224 finalType, noindex ? 1 : 0, fanOnly, nsfw, publishAt,225 finalType, noindex ? 1 : 0, fanOnly, nsfw, cw, publishAt, 225 226 now, now, publishedAt 226 227 ); … … 239 240 id: postId, slug: finalSlug, title: title || finalSlug, 240 241 content: cleanContent, cover_image_url: cover_image_url || null, 241 published_at: publishedAt, created_at: now, fan_only: fanOnly, nsfw, 242 published_at: publishedAt, created_at: now, fan_only: fanOnly, nsfw, content_warning: cw, 242 243 }).catch(() => { /* best-effort */ }); 243 244 } … … 298 299 const fanOnly = req.body.fan_only ? 1 : 0; 299 300 const nsfw = req.body.nsfw ? 1 : 0; 301 const cw = (req.body.content_warning || '').trim().slice(0, 200); 300 302 const newSlug = req.body.slug; 301 303 const action = req.body.action || 'save'; … … 336 338 title = ?, content = ?, excerpt = ?, status = ?, 337 339 cover_image_url = ?, pinned = ?, tags = ?, 338 type = ?, noindex = ?, fan_only = ?, nsfw = ?, publish_at = ?,340 type = ?, noindex = ?, fan_only = ?, nsfw = ?, content_warning = ?, publish_at = ?, 339 341 slug = ?, published_at = ?, updated_at = ? 340 342 WHERE id = ? … … 343 345 cover_image_url || null, parsePinnedRank(pinned), 344 346 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 345 finalType, noindex ? 1 : 0, fanOnly, nsfw, publishAt,347 finalType, noindex ? 1 : 0, fanOnly, nsfw, cw, publishAt, 346 348 finalSlug, publishedAt, now, post.id 347 349 ); … … 364 366 id: post.id, slug: finalSlug, title: title || finalSlug, 365 367 content: cleanContent, cover_image_url: cover_image_url || null, 366 published_at: publishedAt, created_at: post.created_at, fan_only: fanOnly, nsfw, 368 published_at: publishedAt, created_at: post.created_at, fan_only: fanOnly, nsfw, content_warning: cw, 367 369 }; 368 370 if (post.status !== 'published') ActivityPubService.deliverCreate(site, apPost).catch(() => { /* best-effort */ });
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)