Add GDPR-compliant cookie consent banner using Silktide

Implements Silktide Consent Manager via jsDelivr CDN for GDPR compliance.
The banner informs users the site only uses essential cookies and allows
them to manage preferences.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-01-08 14:59:21 +00:00
parent 0aafdfa382
commit 39d0de751b
2 changed files with 25 additions and 1 deletions

View File

@@ -67,7 +67,7 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware):
response.headers["Content-Security-Policy"] = ( response.headers["Content-Security-Policy"] = (
"default-src 'self'; " "default-src 'self'; "
"script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; " "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; "
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdn.jsdelivr.net; "
"font-src 'self' https://fonts.gstatic.com; " "font-src 'self' https://fonts.gstatic.com; "
"img-src 'self' data:; " "img-src 'self' data:; "
"connect-src 'self' https://cdn.jsdelivr.net; " "connect-src 'self' https://cdn.jsdelivr.net; "

View File

@@ -55,6 +55,8 @@
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Playfair+Display:wght@600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Playfair+Display:wght@600;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="/static/styles.css"> <link rel="stylesheet" href="/static/styles.css">
<!-- Cookie Consent Banner -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/silktide/consent-manager@main/silktide-consent-manager.css">
</head> </head>
<body> <body>
<div class="noise-overlay"></div> <div class="noise-overlay"></div>
@@ -340,6 +342,28 @@
</footer> </footer>
<script src="/static/app.js"></script> <script src="/static/app.js"></script>
<!-- Cookie Consent Banner -->
<script src="https://cdn.jsdelivr.net/gh/silktide/consent-manager@main/silktide-consent-manager.js"></script>
<script>
window.silktideConsentManager.init({
consentTypes: [
{
id: 'necessary',
label: 'Necessary',
description: 'Essential cookies required for the website to function properly.',
required: true,
defaultValue: true
}
],
text: {
title: 'Cookie Preferences',
description: 'This website does not use tracking cookies. We only use essential cookies required for the site to function.',
acceptAll: 'Accept',
rejectAll: 'Reject All',
save: 'Save Preferences'
}
});
</script>
</body> </body>
</html> </html>