Implement moreminimore-style consent backend with better-sqlite3

- Add @astrojs/node adapter for hybrid SSR mode
- Replace console logging with better-sqlite3 database storage
- Create data/ directory for consent.db persistence
- Full consent API: POST (log), GET (fetch), DELETE (remove)
- Admin dashboard at /admin/consent-logs.astro with:
  - Password auth via sessionStorage
  - Stats cards (total, analytics accepted, rejected, rate %)
  - 100 latest logs table
  - Export to CSV functionality
  - Delete individual records
- New Dockerfile: node:20-alpine + sqlite-libs runtime
- Admin password: Coolm@n1234mo

Note: Static pages remain prerendered, only API/admin routes are SSR.
This commit is contained in:
Kunthawat
2026-04-01 15:41:46 +07:00
parent a1c9930d49
commit 88fcde1d62
9 changed files with 439 additions and 109 deletions

4
.astro/integrations/astro_db/db.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
// This file is generated by Astro DB
declare module 'astro:db' {
}