Changeset 837fc9c in Klonkt for src/routes/posts.js
- Timestamp:
- 06/27/2026 07:51:44 AM (2 months ago)
- Branches:
- main
- Children:
- 92f6976
- Parents:
- aa45208
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
raa45208 r837fc9c 176 176 const { title, slug, content, excerpt, status, pinned, cover_image_url, tags, noindex, type } = req.body; 177 177 const fanOnly = req.body.fan_only ? 1 : 0; 178 const nsfw = req.body.nsfw ? 1 : 0; 178 179 179 180 // Content arrives as user-authored HTML from the WYSIWYG editor — sanitize … … 213 214 INSERT INTO posts ( 214 215 id, site_id, slug, author_id, title, content, excerpt, 215 status, cover_image_url, pinned, tags, type, noindex, fan_only, publish_at,216 status, cover_image_url, pinned, tags, type, noindex, fan_only, nsfw, publish_at, 216 217 created_at, updated_at, published_at 217 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )218 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 218 219 `).run( 219 220 postId, site.id, finalSlug, req.session.user.id, … … 221 222 finalStatus, cover_image_url || null, parsePinnedRank(pinned), 222 223 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 223 finalType, noindex ? 1 : 0, fanOnly, publishAt,224 finalType, noindex ? 1 : 0, fanOnly, nsfw, publishAt, 224 225 now, now, publishedAt 225 226 ); … … 238 239 id: postId, slug: finalSlug, title: title || finalSlug, 239 240 content: cleanContent, cover_image_url: cover_image_url || null, 240 published_at: publishedAt, created_at: now, fan_only: fanOnly, 241 published_at: publishedAt, created_at: now, fan_only: fanOnly, nsfw, 241 242 }).catch(() => { /* best-effort */ }); 242 243 } … … 296 297 const { title, content, excerpt, status, pinned, cover_image_url, tags, noindex, type } = req.body; 297 298 const fanOnly = req.body.fan_only ? 1 : 0; 299 const nsfw = req.body.nsfw ? 1 : 0; 298 300 const newSlug = req.body.slug; 299 301 const action = req.body.action || 'save'; … … 334 336 title = ?, content = ?, excerpt = ?, status = ?, 335 337 cover_image_url = ?, pinned = ?, tags = ?, 336 type = ?, noindex = ?, fan_only = ?, publish_at = ?,338 type = ?, noindex = ?, fan_only = ?, nsfw = ?, publish_at = ?, 337 339 slug = ?, published_at = ?, updated_at = ? 338 340 WHERE id = ? … … 341 343 cover_image_url || null, parsePinnedRank(pinned), 342 344 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 343 finalType, noindex ? 1 : 0, fanOnly, publishAt,345 finalType, noindex ? 1 : 0, fanOnly, nsfw, publishAt, 344 346 finalSlug, publishedAt, now, post.id 345 347 ); … … 362 364 id: post.id, slug: finalSlug, title: title || finalSlug, 363 365 content: cleanContent, cover_image_url: cover_image_url || null, 364 published_at: publishedAt, created_at: post.created_at, fan_only: fanOnly, 366 published_at: publishedAt, created_at: post.created_at, fan_only: fanOnly, nsfw, 365 367 }; 366 368 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)