Changeset b9dc94c in Klonkt for src/views/pages/post-edit.ejs


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/views/pages/post-edit.ejs

    r6be57b4 rb9dc94c  
    193193          <span>🚫 noindex (verberg voor zoekmachines)</span>
    194194        </label>
     195        <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
     196          <label class="pe-checkbox">
     197            <input type="checkbox" name="fan_only" value="1" <%= post.fan_only ? 'checked' : '' %>>
     198            <span>🔒 Alleen voor ingelogde fans</span>
     199          </label>
     200          <div style="margin-top:8px">
     201            <label style="display:block;font-size:12.5px;opacity:.8;margin-bottom:4px">📅 Publiceren op (laat leeg = direct)</label>
     202            <input type="datetime-local" name="publish_at" value="<%= post.publish_at ? String(post.publish_at).replace(' ','T').slice(0,16) : '' %>" style="padding:8px 10px;border-radius:8px;border:1px solid var(--rule,rgba(128,128,128,.4));background:transparent;color:inherit">
     203            <% if (post.status === 'scheduled' && post.publish_at) { %><div style="font-size:12px;opacity:.7;margin-top:4px">⏳ Ingepland voor <%= post.publish_at %></div><% } %>
     204          </div>
     205        <% } %>
    195206      </div>
    196207    </section>
Note: See TracChangeset for help on using the changeset viewer.