Changeset d18c60e in Klonkt for src/routes
- Timestamp:
- 07/01/2026 06:55:46 PM (2 months ago)
- Branches:
- main
- Children:
- 0688b5f
- Parents:
- 43273c9
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r43273c9 rd18c60e 246 246 const nsfw = req.body.nsfw ? 1 : 0; 247 247 const cw = (req.body.content_warning || '').trim().slice(0, 200); 248 const coverAlt = (req.body.cover_alt || '').trim().slice(0, 1500) || null; // cover alt text (a11y) 248 249 249 250 // Content arrives as user-authored HTML from the WYSIWYG editor — sanitize … … 284 285 INSERT INTO posts ( 285 286 id, site_id, slug, author_id, title, content, excerpt, 286 status, cover_image_url, cover_video_url, pinned, tags, type, noindex, fan_only, nsfw, content_warning, poll_json, publish_at,287 status, cover_image_url, cover_video_url, cover_alt, pinned, tags, type, noindex, fan_only, nsfw, content_warning, poll_json, publish_at, 287 288 created_at, updated_at, published_at 288 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )289 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 289 290 `).run( 290 291 postId, site.id, finalSlug, req.session.user.id, 291 292 title || finalSlug, cleanContent, excerpt || '', 292 finalStatus, cover_image_url || null, (req.body.cover_video_url || null), parsePinnedRank(pinned),293 finalStatus, cover_image_url || null, (req.body.cover_video_url || null), coverAlt, parsePinnedRank(pinned), 293 294 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 294 295 finalType, noindex ? 1 : 0, fanOnly, nsfw, cw, pollJson, publishAt, … … 312 313 ActivityPubService.deliverCreate(site, { 313 314 id: postId, slug: finalSlug, title: title || finalSlug, 314 content: cleanContent, cover_image_url: cover_image_url || null, cover_video_url: req.body.cover_video_url || null, 315 content: cleanContent, cover_image_url: cover_image_url || null, cover_video_url: req.body.cover_video_url || null, cover_alt: coverAlt, 315 316 published_at: publishedAt, created_at: now, fan_only: fanOnly, nsfw, content_warning: cw, poll_json: pollJson, 316 317 }).catch(() => { /* best-effort */ }); … … 379 380 const nsfw = req.body.nsfw ? 1 : 0; 380 381 const cw = (req.body.content_warning || '').trim().slice(0, 200); 382 const coverAlt = (req.body.cover_alt || '').trim().slice(0, 1500) || null; // cover alt text (a11y) 381 383 const newSlug = req.body.slug; 382 384 const action = req.body.action || 'save'; … … 422 424 UPDATE posts SET 423 425 title = ?, content = ?, excerpt = ?, status = ?, 424 cover_image_url = ?, cover_video_url = ?, pinned = ?, tags = ?,426 cover_image_url = ?, cover_video_url = ?, cover_alt = ?, pinned = ?, tags = ?, 425 427 type = ?, noindex = ?, fan_only = ?, nsfw = ?, content_warning = ?, poll_json = ?, publish_at = ?, 426 428 slug = ?, published_at = ?, updated_at = ? … … 428 430 `).run( 429 431 title, cleanContent, excerpt, finalStatus, 430 cover_image_url || null, (req.body.cover_video_url || null), parsePinnedRank(pinned),432 cover_image_url || null, (req.body.cover_video_url || null), coverAlt, parsePinnedRank(pinned), 431 433 JSON.stringify((tags || '').split(',').map(t => t.trim()).filter(Boolean)), 432 434 finalType, noindex ? 1 : 0, fanOnly, nsfw, cw, pollJson, publishAt, … … 454 456 const apPost = { 455 457 id: post.id, slug: finalSlug, title: title || finalSlug, 456 content: cleanContent, cover_image_url: cover_image_url || null, cover_video_url: req.body.cover_video_url || null, 458 content: cleanContent, cover_image_url: cover_image_url || null, cover_video_url: req.body.cover_video_url || null, cover_alt: coverAlt, 457 459 published_at: publishedAt, created_at: post.created_at, fan_only: fanOnly, nsfw, content_warning: cw, poll_json: pollJson, 458 460 };
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)