Changeset b7d4458 in Klonkt for src/routes/posts.js
- Timestamp:
- 06/27/2026 08:10:43 AM (2 months ago)
- Branches:
- main
- Children:
- c21197a
- Parents:
- 92f6976
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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)