Changeset b9dc94c in Klonkt for src/server.js


Ignore:
Timestamp:
06/19/2026 04:28:02 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
8d32dcf
Parents:
6be57b4
Message:

Release scheduling + fan-only previews (premium feature #3)

  • DB: posts.publish_at (scheduled go-live) + posts.fan_only.
  • Release scheduling: published + future publish_at -> status 'scheduled' (excluded from public status='published' queries). Scheduler.js publishes them when the time is reached (setInterval 60s + on boot) + adds them to posts_fts. No public queries changed -> low risk.
  • Fan-only: posts.fan_only; the single-post view shows anonymous visitors a clean login gate (pages/fan-gate.ejs, link /auth/login?next=) instead of the content; logged-in fans see everything. Listings show the teaser.
  • create/save: read publish_at + fan_only; FTS excludes 'scheduled'.
  • editor (post-edit): premium-gated fields "Fans only" + "Publish on" (datetime-local) + "scheduled for" notice.
  • server.js: startScheduler() after initializeDatabase.

node --check passed.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/server.js

    r6be57b4 rb9dc94c  
    1616import http from 'http';
    1717import db, { initializeDatabase } from './config/database.js';
     18import { startScheduler } from './services/Scheduler.js';
    1819import { SqliteSessionStore } from './services/SqliteSessionStore.js';
    1920import { ensurePrimarySite } from './services/ensurePrimarySite.js';
     
    140141// → crash-loop op de allereerste boot).
    141142initializeDatabase();
     143startScheduler(); // release-planning: zet geplande posts live zodra publish_at bereikt is
    142144
    143145// Vangnet: garandeer dat er altijd een primaire site is (solo/hub/circle).
Note: See TracChangeset for help on using the changeset viewer.