Changeset 8d32dcf in Klonkt


Ignore:
Timestamp:
06/19/2026 06:47:40 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
84325b8
Parents:
b9dc94c
Message:

Show agenda + notify-me (premium feature #8) — last of the 8

  • DB: shows (site_id, date, time, city, venue, country, ticket_url, notes).
  • routes/shows.js (public, premium-gated): GET /shows (upcoming shows + notify form), POST /shows/notify (subscribers source 'notify', double opt-in if SMTP; confirm/unsub via the generic /nieuwsbrief links).
  • routes/admin-shows.js (site admin + premium): GET /admin/shows (list + add form + subscriber count), POST / (add; optional notify email to 'notify' subscribers if SMTP is available), POST /:id/delete.
  • SubscriberService.confirmedFor(siteId, source?) — optional source filter ('notify').
  • views: pages/shows.ejs + pages/admin-shows.ejs. Dashboard 📅 Agenda link.

Notify email requires SMTP (like #1/#2 sending); without SMTP the show is saved
and sign-ups still work. node --check passed.

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

Location:
src
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/config/database.js

    rb9dc94c r8d32dcf  
    228228  `);
    229229
     230  // Show-agenda (premium #8): tourdata/optredens per site.
     231  db.exec(`
     232    CREATE TABLE IF NOT EXISTS shows (
     233      id TEXT PRIMARY KEY,
     234      site_id TEXT NOT NULL,
     235      date TEXT NOT NULL,
     236      time TEXT,
     237      city TEXT NOT NULL,
     238      venue TEXT,
     239      country TEXT,
     240      ticket_url TEXT,
     241      notes TEXT,
     242      created_at DATETIME DEFAULT CURRENT_TIMESTAMP
     243    );
     244    CREATE INDEX IF NOT EXISTS idx_shows_site_date ON shows(site_id, date);
     245  `);
     246
    230247  // Link-in-bio klikstatistiek (premium #6). Per (site, url) een teller; de
    231248  // link-in-bio-pagina linkt via /links/go/:i dat de klik telt en doorstuurt.
  • src/server.js

    rb9dc94c r8d32dcf  
    5959import linkbioRoutes from './routes/linkbio.js';
    6060import embedRoutes from './routes/embed.js';
     61import showsRoutes from './routes/shows.js';
     62import adminShowsRoutes from './routes/admin-shows.js';
    6163
    6264if (!process.env.SESSION_SECRET) {
     
    260262app.use('/admin/stats', adminStatsRoutes);
    261263app.use('/admin/newsletter', adminNewsletterRoutes);
     264app.use('/admin/shows', adminShowsRoutes);
    262265app.use('/admin', adminRoutes);
    263266app.use('/prutter', prutterRoutes);
     
    279282app.use('/', linkbioRoutes); // /links link-in-bio + klikstats (premium)
    280283app.use('/', embedRoutes); // /embed inbedbare audiospeler (premium)
     284app.use('/', showsRoutes); // /shows agenda + notify-me (premium)
    281285app.use('/', postsRoutes);
    282286
  • src/services/SubscriberService.js

    rb9dc94c r8d32dcf  
    6969}
    7070
    71 /** Bevestigde abonnees (email + token) voor een site — voor het versturen. */
    72 export function confirmedFor(siteId) {
     71/** Bevestigde abonnees (email + token) voor een site — voor het versturen.
     72 * Optioneel filteren op bron (bv. 'notify' voor show-aankondigingen). */
     73export function confirmedFor(siteId, source) {
     74  if (source) {
     75    return db.prepare("SELECT email, token FROM subscribers WHERE site_id = ? AND status = 'confirmed' AND source = ?").all(siteId, source);
     76  }
    7377  return db.prepare("SELECT email, token FROM subscribers WHERE site_id = ? AND status = 'confirmed'").all(siteId);
    7478}
  • src/views/pages/admin.ejs

    rb9dc94c r8d32dcf  
    3737      <% if (tenancy !== 'hub' && primarySite) { %><a href="/downloads" class="btn" target="_blank">⬇ Downloads</a><% } %>
    3838      <% if (tenancy !== 'hub' && primarySite) { %><a href="/links" class="btn" target="_blank">🔗 Link-in-bio</a><% } %>
     39      <a href="/admin/shows" class="btn">📅 Agenda</a>
    3940    <% } %>
    4041    <a href="/admin/updates" class="btn">🔄 Updates</a>
Note: See TracChangeset for help on using the changeset viewer.