Add the Privacy and Terms pages, data requests and click-to-load embeds

- Privacy Policy (with cookies and storage) and Terms of Service, from
  what the code actually stores and loads; shared LegalText layout
- Data requests: a 'privacy' feedback type sent from the Privacy page's
  form, email required, triaged in Admin -> Feedback
- Migration 039: Panel -> Site settings -> Privacy contact email (over
  site.json's privacyEmail), shown on the Privacy page
- The hero livestream, the hero featured video and schedule maps load
  only when pressed, so no third party sets anything before a click
- A small dismissible privacy notice instead of a consent banner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:34:46 -05:00
parent bff082652a
commit ee61568911
17 changed files with 507 additions and 81 deletions

View file

@ -935,6 +935,7 @@ const siteSettings = {
text("favicon"),
text("apple_touch_icon"),
enumeration("indexing", ["on", "off"]),
text("privacy_email"),
],
children: [

View file

@ -0,0 +1,11 @@
-- ═══════════════════════════════════════════════════════════════
-- 039 PRIVACY CONTACT
--
-- The address the Privacy page gives for privacy questions and data
-- requests (Panel → Site settings). Null falls back to site.json's
-- privacyEmail; blank in both, the page points to its request form
-- only. Data requests themselves are feedback rows of type
-- 'privacy' (routes/feedback.js), triaged in Admin → Feedback.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE site_settings ADD COLUMN privacy_email TEXT;

View file

@ -102,12 +102,13 @@ export function siteFor(db) {
...base.robots,
index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
},
privacyEmail: row.privacy_email || base.privacyEmail || "",
pages,
};
}
/* What the browser app reads for headings and titles. */
const forBrowser = (site) => ({ title: site.title, pages: site.pages });
const forBrowser = (site) => ({ title: site.title, pages: site.pages, privacyEmail: site.privacyEmail });
/* robots.txt for this database's setting, as the build writes it. */
export function robotsTxt(site) {

View file

@ -29,10 +29,10 @@ const LIMITS = {
const MIN_MESSAGE = 10;
// Must match FEEDBACK_TYPES in src/pages/sections/FeedbackForm.jsx.
// Must match FEEDBACK_TYPES and DATA_REQUEST in src/data/feedbackTypes.ts.
// Anything else falls back to 'general' rather than being rejected,
// a renamed option shouldn't lose someone's submission.
const TYPES = ["broken", "confusing", "outdated", "request", "praise", "other"];
const TYPES = ["broken", "confusing", "outdated", "request", "praise", "other", "privacy"];
/* ── Input cleaning ──────────────────────────────────────────── */
@ -76,6 +76,10 @@ feedback.post("/", async (c) => {
const errors = {};
if (message.length < MIN_MESSAGE) errors.message = "Please write a little more.";
if (!looksLikeEmail(email)) errors.email = "That email doesn't look right.";
// A data request (Privacy page) has to be answerable.
else if (feedbackType === "privacy" && !email) {
errors.email = "We need an email address to reply to a data request.";
}
if (Object.keys(errors).length > 0) {
return c.json({ error: "Validation failed", fields: errors }, 422);