Refactor: Add full PDPA compliance features

- Cookie consent system (banner + modal) with Thai language
- Consent logging database (Astro DB + SQLite)
- API endpoints for consent management (POST/GET/DELETE)
- Admin dashboard for viewing consent logs (/admin/consent-logs)
- Umami Analytics integration (conditional loading with consent)
- Updated Privacy Policy (full 14-section PDPA Section 36 compliance)
- Updated Terms & Conditions (17 sections, Thailand law)
- Dockerfile updated with SQLite runtime
- Node.js adapter for SSR support
- Admin password: moreminimore2026!Secure (CHANGE IN PRODUCTION)

TODO: Configure Umami Analytics with actual Website ID
This commit is contained in:
Kunthawat Greethong
2026-03-09 13:08:09 +07:00
parent da8437bed0
commit 14ca77ed09
17 changed files with 2372 additions and 43 deletions

View File

@@ -1,5 +1,7 @@
---
import '../styles/global.css'
import CookieBanner from '../components/consent/CookieBanner.astro';
import ConsentModal from '../components/consent/ConsentModal.astro';
interface Props {
title?: string;
@@ -120,6 +122,7 @@ const { title = 'moreminimore | รับทำเว็บไซต์ฟรี
<div class="flex justify-center gap-6 mb-4">
<a href="/terms-and-conditions" class="hover:text-primary transition">ข้อกำหนดและเงื่อนไข</a>
<a href="/privacy-policy" class="hover:text-primary transition">นโยบายความเป็นส่วนตัว</a>
<button id="consent-preferences-btn" class="hover:text-primary transition">ตั้งค่าคุกกี้</button>
</div>
<p>&copy; {new Date().getFullYear()} moreminimore. สงวนลิขสิทธิ์</p>
</div>
@@ -136,6 +139,36 @@ const { title = 'moreminimore | รับทำเว็บไซต์ฟรี
</a>
</div>
<!-- Cookie Consent Banner -->
<CookieBanner />
<!-- Consent Modal for custom preferences -->
<ConsentModal />
<!-- Consent preferences button in footer should open modal -->
<script is:inline>
const consentBtn = document.getElementById('consent-preferences-btn');
if (consentBtn) {
consentBtn.addEventListener('click', () => {
if (typeof window.openConsentModal === 'function') {
window.openConsentModal();
}
});
}
</script>
<!-- Umami Analytics (Conditional Loading) -->
<script is:inline>
const consent = JSON.parse(localStorage.getItem('consent-preferences') || '{}');
if (consent.analytics) {
const script = document.createElement('script');
script.defer = true;
script.src = 'https://analytics.moreminimore.com/script.js';
script.setAttribute('data-website-id', 'PLACEHOLDER_UMAMI_ID');
document.head.appendChild(script);
}
</script>
<script>
const menuBtn = document.getElementById('mobile-menu-btn');
const mobileMenu = document.getElementById('mobile-menu');