--- // Password-protected admin page for viewing consent logs // Uses API instead of Astro DB (better-sqlite3) to bypass remote SQLite limitation const ADMIN_PASSWORD = Astro.env.ADMIN_PASSWORD || 'changeme'; let logs = []; let isAuthenticated = false; let error = ''; if (Astro.request.method === 'POST') { const formData = await Astro.request.formData(); const password = formData.get('password'); if (password === ADMIN_PASSWORD) { isAuthenticated = true; try { const response = await fetch('/api/consent'); const data = await response.json(); logs = data.logs || []; } catch (err) { error = 'Failed to load consent logs. Make sure the API is running.'; console.error(err); } } else { error = 'Invalid password'; } } ---
Default password: changeme (change in .env)
| Date/Time | Session ID | Essential | Analytics | Marketing | Policy Ver | IP Hash | Action |
|---|---|---|---|---|---|---|---|
| No consent logs found. Make sure the website has received consent. | |||||||
| {new Date(log.timestamp).toLocaleString('th-TH')} | {log.sessionId} | {log.essential ? 'Yes' : 'No'} | {log.analytics ? ( ✓ ) : ( ✗ )} | {log.marketing ? ( ✓ ) : ( ✗ )} | {log.policyVersion} | {log.ipHash} | |