Commit Graph

68 Commits

Author SHA1 Message Date
nmemmert f4fd177421 Add full /data backup export/import for server migration
- New admin endpoints: GET /api/admin-backup/export streams the entire
  data directory as tar.gz (after flushing queued writes); POST
  /api/admin-backup/import validates the archive, snapshots current
  data, replaces the folder, and reloads all in-memory state.
- Admin UI: "Full Data Backup" section with download and restore-from-
  file controls in the Analytics panel.
- Fix admin TOTP secret path to honor SITEFORGE_DATA_DIR (moved base
  path resolution to server/paths.js to avoid a circular import), so
  2FA for admin and study users survives backup/restore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:08:23 -04:00
nmemmert 4b411f763f Add inbound email capture via Cloudflare Email Worker
- Cloudflare Email Worker forwards hello@ and nate@ to Gmail and POSTs
  parsed MIME email to /api/inbound-email as admin inbox entries
- New server route authenticates via shared secret and deduplicates by
  Message-ID before storing inbound emails as contact submissions
- Admin inbox shows "email" badge for inbound messages; reply composer
  opens blank with auto-subject "Re: [original]" and signature preview
- Documents setup steps in cloudflare/email-worker.js and .env.example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 11:23:27 -04:00
nmemmert a8f6024234 Fix Truth For Life devotional widget not rendering
Replaced broken srcdoc iframe approach with direct script injection so
the TFL syndicate.js runs in page context with access to the DOM it needs.
Also added truthforlife.org and ajax.googleapis.com to CSP script-src,
which was silently blocking the widget and its jQuery dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 09:26:00 -04:00
nmemmert 9174331d2d Bug fixes (real breakage):
Newsletter nudge — was calling /api/study-account/profile (wrong endpoint, ignored subscription). Now correctly calls /api/study-account/preferences with PATCH.
Security:

Email regex — replaced the permissive [^\s@]+@[^\s@]+ pattern with a proper RFC-compliant regex in contact.js and downloads.js
Avatar magic bytes — server now checks actual PNG/JPEG/GIF/WEBP header bytes, not just the data URL prefix
Certificate rate limit — public /api/public/certificate/:token now has a 30 req/15min limiter
Session absolute TTL — admin sessions now have a 30-day hard cap; a stolen token can no longer be kept alive indefinitely by passive reads
Account lockout — 5 failed logins locks a study account for 1 hour
CSP headers — Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, and Referrer-Policy headers added globally
Data integrity:

Cascade delete — deleting a study account now also removes their certificates, community posts, comments, and progress file
UX / reliability:

Escape key on modals — all 3 modal groups (study index, notes, account) now close on Escape
Display name min-length — empty spaces-only names rejected; if provided, must be ≥2 chars
Note save rate limit — 30 saves/minute per user max
Analytics fetch timeout — 5s AbortController so a hanging server doesn't block the browser indefinitely
Email validation on signup — frontend catches bad email formats before hitting the server
Cleanup:

Deduplicated download forms — StudyDownloadForm and ResourceDownloadForm now share a single DownloadForm base; both are now thin wrappers
2026-06-18 09:35:44 -04:00
nmemmert 31426fccba Add comprehensive visitor engagement tracking and scroll-to-top on navigation
Tracks scroll depth (25/50/75/90%), time on page, UTM parameters, outbound
link clicks, search queries, audio pause/completion/listen time, and 404s.
Logged-in study users are now tied to their visitor record and surfaced in
the admin recent visits table. Scroll position resets on every route change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 14:06:21 -04:00
nmemmert 8450d81e7f Add per-episode play tracking with bar chart in admin analytics
- POST /api/analytics/play records a play event (title + date) on first
  play per player mount, skipping admin sessions
- Plays persisted to data/episode-plays.json with total + byDay buckets
- Admin stats response includes episodePlays sorted by total plays
- AnalyticsPanel shows horizontal bar chart + summary cards for all
  episodes dynamically — new episodes appear automatically as played

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 13:39:35 -04:00
nmemmert 48c2f81d00 Add QR code tracker to admin panel
Each QR code gets a /qr/<slug> redirect that logs scans (IP, user agent,
timestamp) to disk. The admin QR Codes view lets you add, edit, enable/disable,
and delete codes, with per-code scan history inline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 09:33:35 -04:00
nmemmert c4645e3475 Add cross-site improvements across three phases
Phase 1 — Quick wins:
- Image lazy-loading on series/resource cards
- Newsletter signup added to Episodes page (before highlights)
- Per-route meta tags via usePageMeta hook (title, og:title, og:description)
- Breadcrumbs on study index, section, and notes pages
- SVG completion checkmark badges on study section list
- Analytics time-range filter (7d / 30d / 90d) in admin panel

Phase 2 — Medium features:
- Related episodes on archived series detail pages
- Resource library two-tier filter (type + tag chips)
- Global search (Fuse.js) moved below sticky header as full-width bar
- Q&A anonymous upvoting with localStorage dedup + admin pin/unpin
- Study enrollment funnel tracking (firstVisitAt, firstCompletionAt) with funnel chart in analytics

Phase 3 — Larger features:
- Study section comments (auto-approve for enrolled users, admin moderation panel)
- Study completion certificate (canvas render, PNG download, shareable public URL)
- Episode script full-text search (mammoth docx extraction, server-side search, admin upload UI)
- Reflection questions renamed from Discussion Questions; quiz answers can be shared to section discussion
- Public certificate route at /certificate/:token with og meta tags
- Comment moderation panel added to admin under Manage > Study Comments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 09:10:29 -04:00
nmemmert 346ecb217c refractor server.js 2026-06-03 15:08:14 -04:00
nmemmert e17a818deb fix 2026-06-03 14:31:22 -04:00
nmemmert 68f6212e9b cool stuff 2026-06-03 14:14:25 -04:00
nmemmert a2c4924191 email templates 2026-06-03 13:14:08 -04:00
nmemmert 49c9994156 New admin panel - People → Study Users 2026-06-03 12:29:05 -04:00
nmemmert 4983524ea4 newsletter fix 2026-06-03 12:08:53 -04:00
nmemmert e561bfa000 analytics fixs 2026-06-03 11:35:45 -04:00
nmemmert 3e49ccce62 fix 2026-06-03 11:07:46 -04:00
nmemmert b187b19f18 feat: homepage newsletter, Q&A callout, episodes page redesign, SEO/sitemap, asset tagging
- Fix "Invalid Date" on student account page (memberSince guard)
- Fix study community author showing full email instead of username
- Add newsletter sign-up section to homepage (between PRISM and Current Series)
- Add newsletter opt-in nudge to study enrollment flow
- Redesign episodes page: latest episode featured card + per-episode Spotify embed
- Add SEO description field to episodes page (visually hidden, admin-editable)
- Expand default sitemap paths to include /about, /contact, /episodes, /resources, /study, /study/titus, /study/colossians
- Add featured Q&A callout section to homepage
- Add Q&A callout to study hub footer
- Tag both untagged image assets in Asset Manager
2026-06-03 10:56:55 -04:00
nmemmert 5b448aef0f stuff 2026-06-02 14:02:00 -04:00
nmemmert b18f4e88fa Add study completion, checkpoints, lesson announcements, and lesson-thread defaults 2026-06-02 12:03:29 -04:00
nmemmert 1d536827e3 Improve admin UX and autosave handling 2026-06-01 12:56:26 -04:00
nmemmert eee200cf9c Add study community discussion board and Ask Nate button 2026-05-21 14:04:12 -04:00
nmemmert bd047b029c Fix admin publish data loss for unreleased lessons and harden data persistence 2026-05-21 12:39:28 -04:00
nmemmert da5f77c3c6 Generalize study release-date gating across all studies 2026-05-21 12:29:57 -04:00
nmemmert 74e9f57ea5 Add admin study user enrollment list 2026-05-21 12:08:15 -04:00
nmemmert 376088a52b Add study enrollment manager, profile settings, and email verification flow 2026-05-21 11:46:49 -04:00
nmemmert c66be30b20 changed checklist order and added what is next when collaped. 2026-05-18 08:47:24 -04:00
nmemmert db762c5a05 Add admin podcast checklist UX and persistence updates 2026-05-18 08:26:53 -04:00
nmemmert dba5f16bcd Load draft content in admin while keeping public lesson locks 2026-05-12 15:23:17 -04:00
nmemmert da35006a30 Backfill release dates on startup and hard-lock undated lessons 2026-05-12 15:17:08 -04:00
nmemmert d74151d91d Enforce study lesson release locks and schedule biweekly Monday dates 2026-05-12 15:09:38 -04:00
nmemmert affd903f40 Make homepage study card admin-editable with NEW tag controls 2026-05-12 12:47:13 -04:00
nmemmert becc1b5b27 Enhance admin dashboard and scripture linking 2026-05-12 09:12:55 -04:00
nmemmert 7a48130ffb Add social share buttons and per-question OG share stubs 2026-05-11 11:53:01 -04:00
nmemmert 7568be368e Add Episode Highlights player with Spotify embed auto-resolution and direct embed URL support 2026-05-07 11:36:07 -04:00
nmemmert 3cbb7cc409 Implement comprehensive analytics redesign with bot detection and charts
- Add bot detection logic to differentiate between real traffic and bot traffic
- Detect common bots: search crawlers, social media crawlers, headless browsers, monitoring tools, security scanners
- Expand hit-stats.json to track realHits, botHits, byPathReal, byPathBot, byDayReal, byDayBot, botReasons
- Update analytics API endpoint to return bot/visitor breakdown with 7-day and 30-day comparisons
- Add Chart.js integration with react-chartjs-2 for interactive visualizations
- Create new AnalyticsPanel component with tabbed interface: Overview, Bot Breakdown, Geographic
- Implement graphs showing: 7-day trend (real vs bot), traffic composition (doughnut), bot sources (pie), top pages (bar)
- Display clear KPI cards showing real traffic %, bot traffic %, return visitor rate
- Add deployment & cache status section to analytics dashboard
- Improve data presentation with responsive grid layouts and color-coded metrics
2026-05-07 10:06:32 -04:00
nmemmert 583a9b7b66 Implement email tab redesign, archive support, manual Q&A creation, URL linking, and question admin tools
- Add dedicated Emails tab with inbox/archive views and two-pane layout
- Implement archive/unarchive for contact submissions with persisted state
- Add manual question creation endpoint and admin form (non-contact origin)
- Implement URL auto-linking in Q&A answers with safe rendering
- Add question admin tools: search, filter (All/Pending/Approved/Answered/Unanswered), pagination
- Expand admin panel widths to reduce cramping
- Restore and enhance Asset Manager table layout
- Update email reply template with fixed from-address and HTML support
2026-05-07 09:43:16 -04:00
nmemmert 9f0aa8bd65 Make welcome email editable in admin and skip admin notice for newsletter signups 2026-05-06 15:45:44 -04:00
nmemmert 272eb607c8 Add personalized newsletter welcome email flow 2026-05-06 15:38:16 -04:00
nmemmert 7c02062663 Make all site content editable from admin; add per-page content blocks 2026-05-05 16:17:23 -04:00
nmemmert 1551599305 Beta: TOTP 2FA, admin asset manager, resource page redesign, rate limiting, and security hardening 2026-05-04 13:56:04 -04:00
nmemmert 7f56060d6b Beta: admin assets, resource download forms, and resource page redesign 2026-04-30 15:47:10 -04:00
nmemmert b26103b7b1 Reorganize admin workflow and persist episode discussion questions 2026-04-27 16:25:26 -04:00
nmemmert 88860bc42a Serve images first-party and remove necloud domain refs 2026-04-27 10:58:09 -04:00
nmemmert c5cc28b36b Fix podcast art route for Docker runtime dist path 2026-04-27 10:38:57 -04:00
nmemmert 73b8299f1a Add podcast redirects and route through first-party links 2026-04-27 10:31:10 -04:00
nmemmert 8a71aecb4e Refine homepage sections and contact card design 2026-04-20 15:38:55 -04:00
nmemmert cc4a4b4d63 Gate Titus download, require full name forms, remove companion UI 2026-04-20 11:29:37 -04:00
nmemmert 50459b7234 Enhance chatbot conversation engine and add retrieval eval suite 2026-04-14 10:36:22 -04:00
nmemmert 063f5d2a0e Add episode transcripts, expand chatbot Q&A database to 28 entries, and build scripts 2026-04-13 10:29:06 -04:00
nmemmert 770d2357ac Add simple auth for admin access 2026-04-12 13:34:11 -04:00