From 99d83eb090424abe84c7b1e3e53298ee22d0ee84 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Tue, 29 Sep 2026 09:19:06 -0500 Subject: [PATCH 1/4] Separate data requests from website feedback in the admin Forms now has two queues, Website feedback and Data requests, each its own card on the admin home and a tab on the page, with what's new in each. The API takes ?kind=feedback|privacy and counts per queue. Co-Authored-By: Claude Opus 5.5 --- server/src/routes/admin.js | 24 ++++++++++++--- src/App.tsx | 1 + src/pages/Privacy.tsx | 2 +- src/pages/admin/AdminFeedback.tsx | 49 ++++++++++++++++++++++++++----- src/pages/admin/adminNav.ts | 5 ++++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/server/src/routes/admin.js b/server/src/routes/admin.js index 5914fe2..e14cd1c 100644 --- a/server/src/routes/admin.js +++ b/server/src/routes/admin.js @@ -23,6 +23,8 @@ const NOTE_LIMIT = 2000; /* ── GET /api/admin/feedback ───────────────────────────────────── ?status=new one of STATUSES, or omitted for all + ?kind=feedback website feedback (every type but 'privacy') + ?kind=privacy data requests from the Privacy page ?type=broken feedback_type ?q=retreat substring of the message ?before=41 cursor: rows with a lower id than this @@ -31,11 +33,17 @@ const NOTE_LIMIT = 2000; admin.get("/feedback", (c) => { const db = c.get("db"); - const { status, type, q, before, limit } = c.req.query(); + const { status, type, kind, q, before, limit } = c.req.query(); const where = []; const params = []; + // Data requests and website feedback share the table but are two + // queues in the admin (Forms → Website feedback, Data requests). + const kindWhere = + kind === "privacy" ? "feedback_type = 'privacy'" : kind === "feedback" ? "feedback_type <> 'privacy'" : null; + if (kindWhere) where.push(kindWhere); + if (STATUSES.includes(status)) { where.push("status = ?"); params.push(status); @@ -69,19 +77,27 @@ admin.get("/feedback", (c) => { const hasMore = rows.length > take; const page = hasMore ? rows.slice(0, take) : rows; - // Counts are unfiltered on purpose: the tabs should show what's - // waiting overall, not what's left after the current filter. + // Status counts cover this queue (kind) but ignore the other + // filters: the tabs show what's waiting, not what's left after a + // search. newByKind is what's new in each queue, for the queue tabs. const counts = Object.fromEntries(STATUSES.map((s) => [s, 0])); for (const row of db - .prepare("SELECT status, COUNT(*) AS n FROM feedback GROUP BY status") + .prepare(`SELECT status, COUNT(*) AS n FROM feedback ${kindWhere ? `WHERE ${kindWhere}` : ""} GROUP BY status`) .all()) { counts[row.status] = row.n; } + const newByKind = db + .prepare( + `SELECT SUM(feedback_type <> 'privacy') AS feedback, SUM(feedback_type = 'privacy') AS privacy + FROM feedback WHERE status = 'new'`, + ) + .get(); return c.json( { feedback: page, counts, + newByKind: { feedback: newByKind?.feedback ?? 0, privacy: newByKind?.privacy ?? 0 }, nextCursor: hasMore ? page[page.length - 1].id : null, }, 200, diff --git a/src/App.tsx b/src/App.tsx index 3bd6951..8252b6c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -128,6 +128,7 @@ export default function App() { } /> } /> + } /> } /> }> } /> diff --git a/src/pages/Privacy.tsx b/src/pages/Privacy.tsx index 0e1d1ff..582790c 100644 --- a/src/pages/Privacy.tsx +++ b/src/pages/Privacy.tsx @@ -21,7 +21,7 @@ const PAGE = sitePage("/privacy"); The contact address is Panel → Site settings → Privacy contact email. Requests from the form below are feedback rows of type - 'privacy', in Admin → Feedback. + 'privacy', in Admin → Forms → Data requests. ═══════════════════════════════════════════════════════════════ */ const LAST_UPDATED = "September 28, 2026"; diff --git a/src/pages/admin/AdminFeedback.tsx b/src/pages/admin/AdminFeedback.tsx index 5068d91..b9c6edd 100644 --- a/src/pages/admin/AdminFeedback.tsx +++ b/src/pages/admin/AdminFeedback.tsx @@ -18,7 +18,7 @@ ═══════════════════════════════════════════════════════════════ */ import { useCallback, useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { del, get, patch, ApiError } from "../../lib/api.ts"; import { isUnauthorized, useAuth } from "../../lib/auth.tsx"; @@ -225,9 +225,25 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) { /* ── The page ────────────────────────────────────────────────── */ -export default function AdminFeedback() { +/* The two queues this page shows: the website feedback form, and + data requests from the Privacy page. Same table, same triage. */ +const QUEUES = { + feedback: { + to: "/admin/feedback", + title: "Website feedback", + blurb: "Everything submitted through the site's feedback form.", + }, + privacy: { + to: "/admin/data-requests", + title: "Data requests", + blurb: "Requests to see, correct or delete someone's information, from the Privacy page. Each has an email to answer.", + }, +} as const; + +export default function AdminFeedback({ kind = "feedback" }: { kind?: keyof typeof QUEUES }) { const { user } = useAuth(); const navigate = useNavigate(); + const queue = QUEUES[kind]; const [status, setStatus] = useState("new"); const [query, setQuery] = useState(""); @@ -235,6 +251,7 @@ export default function AdminFeedback() { const [rows, setRows] = useState([]); const [counts, setCounts] = useState({}); + const [newByKind, setNewByKind] = useState({}); const [cursor, setCursor] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -249,6 +266,7 @@ export default function AdminFeedback() { setError(null); const params = new URLSearchParams(); + params.set("kind", kind); if (status !== "all") params.set("status", status); if (search) params.set("q", search); if (before) params.set("before", String(before)); @@ -257,6 +275,7 @@ export default function AdminFeedback() { const data = await get(`/admin/feedback?${params}`, { ttl: 0 }); setRows((prev) => (before ? [...prev, ...data.feedback] : data.feedback)); setCounts(data.counts); + setNewByKind(data.newByKind ?? {}); setCursor(data.nextCursor); } catch (err) { if (isUnauthorized(err)) { @@ -271,7 +290,7 @@ export default function AdminFeedback() { setLoading(false); } }, - [status, search, navigate], + [kind, status, search, navigate], ); useEffect(() => { @@ -306,11 +325,27 @@ export default function AdminFeedback() { return (
-

Feedback

+ {/* The two queues, each with what's new in it. */} + + +

{queue.title}

- {canWrite - ? "Everything submitted through the site form." - : "Read-only: your account can't change statuses or notes."} + {canWrite ? queue.blurb : "Read-only: your account can't change statuses or notes."}

{/* Filters */} diff --git a/src/pages/admin/adminNav.ts b/src/pages/admin/adminNav.ts index 53aab53..3cd9528 100644 --- a/src/pages/admin/adminNav.ts +++ b/src/pages/admin/adminNav.ts @@ -118,6 +118,11 @@ export const FORMS_NAV = { label: "Website feedback", blurb: "The triage queue for the feedback form.", }, + { + to: "/admin/data-requests", + label: "Data requests", + blurb: "Requests to see, correct or delete someone's information, from the Privacy page.", + }, ], }; From f59ab314e0014f9feb697e3745bfa40f19e3e021 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Tue, 29 Sep 2026 09:19:52 -0500 Subject: [PATCH 2/4] Give the history timeline's small logos the dark-mode backing Co-Authored-By: Claude Opus 5.5 --- src/pages/sections/history/TimelineEntry.tsx | 2 +- src/pages/sections/history/timeline.css | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/sections/history/TimelineEntry.tsx b/src/pages/sections/history/TimelineEntry.tsx index e413a43..5031aec 100644 --- a/src/pages/sections/history/TimelineEntry.tsx +++ b/src/pages/sections/history/TimelineEntry.tsx @@ -78,7 +78,7 @@ export default function TimelineEntry({ item, variant = 'inline' }: Props) { {logo ? ( - + ) : ( Date: Tue, 29 Sep 2026 09:21:48 -0500 Subject: [PATCH 3/4] Give blog posts an optional table of contents Blog posts -> Show contents (migration 043, off by default): with two or more headings, the post's headings sit in a sticky column beside it with the one being read lit (an IntersectionObserver, not a scroll listener), and fold out at the top on phones. Content-block headings now carry anchor ids, so a link can point at one. Co-Authored-By: Claude Opus 5.5 --- server/src/admin-schema/blog.js | 1 + server/src/migrations/043_blog_contents.sql | 10 ++ server/src/routes/blog.js | 1 + server/src/seed-showcase.js | 1 + src/components/ContentBlocks.tsx | 15 ++- src/components/PostContents.tsx | 93 ++++++++++++++ src/lib/adminSchema/blog.ts | 6 + src/lib/contents.ts | 48 +++++++ src/lib/useBlog.ts | 2 + src/pages/BlogPost.tsx | 131 ++++++++++++++------ 10 files changed, 264 insertions(+), 44 deletions(-) create mode 100644 server/src/migrations/043_blog_contents.sql create mode 100644 src/components/PostContents.tsx create mode 100644 src/lib/contents.ts diff --git a/server/src/admin-schema/blog.js b/server/src/admin-schema/blog.js index bece207..55f3da2 100644 --- a/server/src/admin-schema/blog.js +++ b/server/src/admin-schema/blog.js @@ -26,6 +26,7 @@ export const blogPosts = { text("excerpt"), text("cover_image"), text("cover_alt"), + bool("show_contents"), date("published_on"), text("tags"), text("guest_author"), diff --git a/server/src/migrations/043_blog_contents.sql b/server/src/migrations/043_blog_contents.sql new file mode 100644 index 0000000..2064521 --- /dev/null +++ b/server/src/migrations/043_blog_contents.sql @@ -0,0 +1,10 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 043 A POST'S TABLE OF CONTENTS +-- +-- Blog posts → "Show contents": list the post's headings beside it +-- (a fold-out on phones), the one being read lit. Off unless an +-- editor turns it on, since a short post doesn't need one. +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE blog_posts ADD COLUMN show_contents INTEGER NOT NULL DEFAULT 0 + CHECK (show_contents IN (0, 1)); diff --git a/server/src/routes/blog.js b/server/src/routes/blog.js index b3fa816..9407477 100644 --- a/server/src/routes/blog.js +++ b/server/src/routes/blog.js @@ -99,6 +99,7 @@ blog.get("/blog/:id", (c) => { excerpt: row.excerpt, cover_image: row.cover_image, cover_alt: row.cover_alt, + show_contents: row.show_contents === 1, published_on: row.published_on, tags: splitTags(row.tags), authors, diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index c592ed9..5e61cf3 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -462,6 +462,7 @@ tx(db, () => { cover_image: IMAGE, published_on: db.prepare(`SELECT date('now') AS d`).get().d, tags: "Test, Showcase", + show_contents: 1, guest_author: "A Guest Author", guest_photo: IMAGE, is_published: 1, diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index 60385a2..560a5e3 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -39,6 +39,7 @@ import { Anchor, Inline, Paragraphs } from './InlineText.tsx' import VideoPlayer from './VideoPlayer.tsx' import ScheduleBlock from './ScheduleBlock.tsx' import { accentText, BRAND } from '../lib/color.ts' +import { headingAnchors } from '../lib/contents.ts' const BODY = 'var(--color-muted)' @@ -52,11 +53,14 @@ export default function ContentBlocks({ className?: string }) { if (!blocks?.length) return null + // Headings get ids so a post's contents (PostContents) and a shared + // link (#getting-there) can point at them. + const { idAt } = headingAnchors(blocks) return (
{blocks.map((block, index) => ( - + ))}
) @@ -71,20 +75,23 @@ function Caption({ text }: { text?: string | null }) { ) } -function Block({ block, accent }: { block: ContentBlock; accent: string }) { +// Clear of the fixed header when jumped to. +const ANCHOR_MARGIN = { scrollMarginTop: 'calc(var(--header-h, 5rem) + 1rem)' } + +function Block({ block, accent, anchor }: { block: ContentBlock; accent: string; anchor?: string }) { const text = block.text ?? '' switch (block.type) { case 'heading': return ( -

+

{text}

) case 'subheading': return ( -

+

{text}

) diff --git a/src/components/PostContents.tsx b/src/components/PostContents.tsx new file mode 100644 index 0000000..0ad8f4d --- /dev/null +++ b/src/components/PostContents.tsx @@ -0,0 +1,93 @@ +/* ═══════════════════════════════════════════════════════════════ + POST CONTENTS + + A post's table of contents, from its headings (lib/contents.ts). + On a wide screen it's a sticky column beside the post, the + heading you're reading lit; below lg it's a fold-out at the top. + Which heading is lit comes from an IntersectionObserver, not a + scroll listener: the last heading to cross the band just under + the fixed header. + ═══════════════════════════════════════════════════════════════ */ + +import { useEffect, useState } from 'react' + +import type { ContentsEntry } from '../lib/contents.ts' +import { scrollBehavior } from '../lib/motion.ts' + +function useLit(entries: ContentsEntry[]) { + const [lit, setLit] = useState(entries[0]?.id ?? null) + const ids = entries.map((entry) => entry.id).join('|') + + useEffect(() => { + const els = ids + .split('|') + .map((id) => document.getElementById(id)) + .filter((el): el is HTMLElement => Boolean(el)) + if (els.length === 0) return + // The band: from just under the header to 60% up the screen. + const header = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--header-h')) || 80 + const observer = new IntersectionObserver( + (records) => { + const crossing = records.filter((r) => r.isIntersecting).map((r) => r.target.id) + if (crossing.length) setLit(crossing[0]) + }, + { rootMargin: `-${header + 16}px 0px -60% 0px` }, + ) + els.forEach((el) => observer.observe(el)) + return () => observer.disconnect() + }, [ids]) + + return lit +} + +function jump(event: React.MouseEvent, id: string) { + event.preventDefault() + document.getElementById(id)?.scrollIntoView({ behavior: scrollBehavior(), block: 'start' }) + history.replaceState(null, '', `#${id}`) +} + +function List({ entries, lit }: { entries: ContentsEntry[]; lit: string | null }) { + return ( +
    + {entries.map((entry) => ( +
  1. + jump(event, entry.id)} + aria-current={entry.id === lit ? 'location' : undefined} + className={ + 'block rounded-lg border-l-2 px-3 py-1.5 transition-colors ' + + (entry.id === lit + ? 'border-link bg-tint font-semibold text-link' + : 'border-transparent text-muted hover:text-link') + } + > + {entry.text} + +
  2. + ))} +
+ ) +} + +export default function PostContents({ entries }: { entries: ContentsEntry[] }) { + const lit = useLit(entries) + return ( + <> +
+ On this page +
+ +
+
+ + + ) +} diff --git a/src/lib/adminSchema/blog.ts b/src/lib/adminSchema/blog.ts index 39749ee..9a4280f 100644 --- a/src/lib/adminSchema/blog.ts +++ b/src/lib/adminSchema/blog.ts @@ -53,6 +53,12 @@ export const blogPosts = { help: "A sentence or two for the card. Default: the body's first paragraph.", }, { path: "cover_image", label: "Cover image", widget: "image", resolve: mediaUrl, full: true }, + { + path: "show_contents", + label: "Show contents", + widget: "checkbox", + help: "Lists the post's headings beside it, the one being read lit (a fold-out on phones). Worth it for a long post with two or more headings.", + }, { path: "cover_alt", label: "Cover description", diff --git a/src/lib/contents.ts b/src/lib/contents.ts new file mode 100644 index 0000000..93cd6c3 --- /dev/null +++ b/src/lib/contents.ts @@ -0,0 +1,48 @@ +/* ═══════════════════════════════════════════════════════════════ + CONTENTS + + The headings in a list of content blocks, with the anchor id each + one gets: ContentBlocks puts the ids on the headings, and + PostContents lists them. Both call headingAnchors on the same + blocks, so the links always match. + + An id is the heading's text as a slug ("Getting there" → + "getting-there"); a repeat gets -2, -3. + ═══════════════════════════════════════════════════════════════ */ + +import type { ContentBlock } from './useContent.ts' + +export type ContentsEntry = { id: string; text: string; level: 1 | 2 } + +const slug = (text: string) => + text + .toLowerCase() + .normalize('NFKD') + .replace(/[^\w\s-]/g, '') + .trim() + .replace(/[\s_]+/g, '-') + .replace(/-+/g, '-') + .slice(0, 60) || 'section' + +/* One entry per heading or subheading block, in order, and the id + for each block index that is one. */ +export function headingAnchors(blocks?: ContentBlock[] | null): { + entries: ContentsEntry[] + idAt: Map +} { + const entries: ContentsEntry[] = [] + const idAt = new Map() + const seen = new Map() + ;(blocks ?? []).forEach((block, index) => { + if (block.type !== 'heading' && block.type !== 'subheading') return + const text = (block.text ?? '').trim() + if (!text) return + const base = slug(text) + const n = (seen.get(base) ?? 0) + 1 + seen.set(base, n) + const id = n === 1 ? base : `${base}-${n}` + idAt.set(index, id) + entries.push({ id, text, level: block.type === 'heading' ? 1 : 2 }) + }) + return { entries, idAt } +} diff --git a/src/lib/useBlog.ts b/src/lib/useBlog.ts index fb33f4f..69f1895 100644 --- a/src/lib/useBlog.ts +++ b/src/lib/useBlog.ts @@ -25,6 +25,8 @@ export type BlogPostRecord = { excerpt?: string | null cover_image?: string | null cover_alt?: string | null + /** List the post's headings beside it. */ + show_contents?: boolean published_on?: string | null tags: string[] authors: BlogAuthor[] diff --git a/src/pages/BlogPost.tsx b/src/pages/BlogPost.tsx index 7ada762..e44eff1 100644 --- a/src/pages/BlogPost.tsx +++ b/src/pages/BlogPost.tsx @@ -10,20 +10,22 @@ section is where posts are listed, so "back" goes there. ═══════════════════════════════════════════════════════════════ */ -import { Link, useParams } from 'react-router-dom' +import { Link, useParams } from "react-router-dom" -import PageShell, { type ShellSection } from '../components/PageShell.tsx' -import PageState from '../components/PageState.tsx' -import ContentBlocks from '../components/ContentBlocks.tsx' -import PeopleTiles from '../components/PeopleTiles.tsx' -import { mediaUrl } from '../lib/media.ts' -import { postDate, useBlogPost } from '../lib/useBlog.ts' -import { accentText, BRAND } from '../lib/color.ts' +import PageShell, { type ShellSection } from "../components/PageShell.tsx" +import PageState from "../components/PageState.tsx" +import ContentBlocks from "../components/ContentBlocks.tsx" +import PeopleTiles from "../components/PeopleTiles.tsx" +import { mediaUrl } from "../lib/media.ts" +import { postDate, useBlogPost } from "../lib/useBlog.ts" +import { accentText, BRAND } from "../lib/color.ts" +import PostContents from "../components/PostContents.tsx" +import { headingAnchors } from "../lib/contents.ts" -const BODY = 'var(--color-muted)' +const BODY = "var(--color-muted)" /* Where "back" goes: the section on the Community page. */ -const BACK = { to: '/community#blog', label: 'Community Blog' } +const BACK = { to: "/community#blog", label: "Community Blog" } export default function BlogPost() { const { id } = useParams() @@ -43,12 +45,16 @@ export default function BlogPost() { ) } + // Two headings or more make a list worth showing. + const contents = post.show_contents ? headingAnchors(post.blocks).entries : [] + const withContents = contents.length >= 2 + const date = postDate(post.published_on) const cover = mediaUrl(post.cover_image) const byline = [ ...post.authors.map((author) => author.name), ...(post.guest ? [post.guest.name] : []), - ].join(', ') + ].join(", ") const authors = [ ...post.authors.map((author) => ({ @@ -58,50 +64,89 @@ export default function BlogPost() { pronouns: author.pronouns, photo: mediaUrl(author.photo), })), - ...(post.guest ? [{ name: post.guest.name, title: 'Guest author', photo: mediaUrl(post.guest.photo) }] : []), + ...(post.guest + ? [ + { + name: post.guest.name, + title: "Guest author", + photo: mediaUrl(post.guest.photo), + }, + ] + : []), ] const sections: ShellSection[] = [ { - id: 'post', - title: 'Post', + id: "post", + title: "Post", accent: BRAND, - background: 'var(--color-surface)', + background: "var(--color-surface)", content: ( -
-
- {date && } - {byline && By {byline}} - {post.tags.map((tag) => ( - + {withContents && } +
+
+ {date && ( + + )} + {byline && By {byline}} + {post.tags.map((tag) => ( + + {tag} + + ))} + - {tag} - - ))} - - {BACK.label} - -
+ {BACK.label} + +
- {cover && ( - {post.cover_alt - )} + {cover && ( + {post.cover_alt + )} - -
+ + +
), }, ] if (authors.length > 0) { sections.push({ - id: 'authors', - title: authors.length === 1 ? 'About the author' : 'About the authors', + id: "authors", + title: authors.length === 1 ? "About the author" : "About the authors", accent: BRAND, - background: 'var(--color-tint)', + background: "var(--color-tint)", content: (
@@ -110,5 +155,11 @@ export default function BlogPost() { }) } - return + return ( + + ) } From 2b009beac13970a194f3ec44707dba010823463c Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Tue, 29 Sep 2026 09:23:29 -0500 Subject: [PATCH 4/4] Use organization-neutral names in code and browser keys - The timeline's ngu-tl classes and keyframes are site-tl; nguLogo is siteLogo; the event card's ngu grid area is org; window.__NGU_SITE__ is window.__SITE__; QR downloads are qr-.png - Browser keys (theme, closed banner and privacy notice, chunk reload) start site-; the page's first script moves any old ngu- values over once, so nobody loses their theme or sees a closed notice again - Session and Google sign-in cookies are site_session and site_oauth (__Host- over https); everyone signs in again once Record ids, server paths, the service and the database file keep their names. Co-Authored-By: Claude Opus 5.5 --- docs/security-headers.md | 8 +- index.html | 12 +- server/src/auth.js | 2 +- server/src/index.js | 2 +- server/src/pageMeta.js | 4 +- server/src/routes/auth.js | 2 +- src/App.tsx | 2 +- src/components/Banner.tsx | 2 +- src/components/Footer.tsx | 4 +- src/components/Layout.tsx | 4 +- src/components/PrivacyNotice.tsx | 2 +- src/components/ThemeToggle.tsx | 2 +- src/index.css | 8 +- src/lib/site.ts | 4 +- src/pages/admin/AdminLayout.tsx | 4 +- src/pages/sections/EventList-Cards.tsx | 2 +- src/pages/sections/QrCodeMaker.tsx | 2 +- .../sections/history/HistoryTimeline.tsx | 10 +- src/pages/sections/history/TimelineDecade.tsx | 18 +- src/pages/sections/history/TimelineEntry.tsx | 38 ++-- .../sections/history/TimelineUpcoming.tsx | 12 +- src/pages/sections/history/TimelineYear.tsx | 36 ++-- src/pages/sections/history/timeline.css | 192 +++++++++--------- 23 files changed, 191 insertions(+), 181 deletions(-) diff --git a/docs/security-headers.md b/docs/security-headers.md index d7c2baf..9c72ce6 100644 --- a/docs/security-headers.md +++ b/docs/security-headers.md @@ -45,10 +45,10 @@ Both lines are already in every proxied block in `nginx-dev` and in ## Sign-in -- The session cookie is `__Host-ngu_session`: the browser only +- The session cookie is `__Host-site_session`: the browser only accepts it Secure, on path `/`, with no Domain, so another subdomain can't set or overwrite it. With `COOKIE_SECURE=false` - (plain-http local work) it's `ngu_session`, since the prefix needs + (plain-http local work) it's `site_session`, since the prefix needs Secure. - Logins are limited per IP where `/api/auth/login` is mounted (10 per 15 minutes, `server/src/index.js`) and per email in @@ -64,8 +64,8 @@ Both lines are already in every proxied block in `nginx-dev` and in entry becomes the proxy's address and every visitor shares one rate-limit bucket: set nginx's `real_ip_header` and `set_real_ip_from` for the proxy first. -- The Google sign-in state cookie is `__Host-ngu_oauth` (plain - `ngu_oauth` over local http), and the page it returns to is checked +- The Google sign-in state cookie is `__Host-site_oauth` (plain + `site_oauth` over local http), and the page it returns to is checked again when the browser comes back. ## From nginx: HSTS diff --git a/index.html b/index.html index ae2cbc2..6c16a39 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,17 @@ flash: this browser's choice (ThemeToggle), else the system. --> `, + ``, site.themeCss && ``, ].filter(Boolean); diff --git a/server/src/routes/auth.js b/server/src/routes/auth.js index c86ce55..d798f87 100644 --- a/server/src/routes/auth.js +++ b/server/src/routes/auth.js @@ -138,7 +138,7 @@ auth.get("/me", (c) => { // the redirect from Google, which is a top-level navigation. // __Host- (Secure, path /, no Domain) when over https, like the // session cookie, so a sibling subdomain can't plant its own state. -const OAUTH_COOKIE = SECURE_COOKIE ? "__Host-ngu_oauth" : "ngu_oauth"; +const OAUTH_COOKIE = SECURE_COOKIE ? "__Host-site_oauth" : "site_oauth"; const OAUTH_COOKIE_OPTIONS = { httpOnly: true, secure: SECURE_COOKIE, diff --git a/src/App.tsx b/src/App.tsx index 8252b6c..2f20f98 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,7 +25,7 @@ import Home from "./pages/Home.tsx" /* A page's chunk can be missing when a deploy replaced the build while this tab still ran the old one. Reload once to pick up the new build; if that doesn't help, let the error surface. */ -const CHUNK_RELOAD = "ngu-chunk-reload" +const CHUNK_RELOAD = "site-chunk-reload" const lazyPage = (load) => lazy(() => load() diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index af1df71..e5d32e6 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -5,7 +5,7 @@ import { SITE_BANNER } from "../data/bannerConfig.ts"; export default function Banner() { const [visible, setVisible] = useState(false); - const storageKey = `ngu-banner-dismissed:${SITE_BANNER.id}`; + const storageKey = `site-banner-dismissed:${SITE_BANNER.id}`; useEffect(() => { if (!SITE_BANNER.enabled) return; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 41754f7..0c8e37f 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,6 +1,6 @@ import { Link } from "react-router-dom"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; -import nguLogo from "../assets/logos/NGU_Logo.svg"; +import siteLogo from "../assets/logos/NGU_Logo.svg"; import PlatformIcon from "./PlatformIcon.tsx"; const Social_Links = [ @@ -59,7 +59,7 @@ export default function Footer() { width below them. */}
- Next Generation of Unity + Next Generation of Unity
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 057e0c6..3bbf9ae 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -3,7 +3,7 @@ import { Suspense, useState, useEffect, useRef } from "react"; import { NavLink, Link, Outlet, useLocation } from "react-router-dom"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import Banner from "./Banner.tsx"; -import nguLogo from "../assets/logos/NGU_Logo.svg"; +import siteLogo from "../assets/logos/NGU_Logo.svg"; import Footer from "./Footer.tsx"; import PrivacyNotice from "./PrivacyNotice.tsx"; import ThemeToggle from "./ThemeToggle.tsx"; @@ -187,7 +187,7 @@ export default function Layout() { >
- Next Generation of Unity + Next Generation of Unity
diff --git a/src/components/PrivacyNotice.tsx b/src/components/PrivacyNotice.tsx index 32d9d16..9453846 100644 --- a/src/components/PrivacyNotice.tsx +++ b/src/components/PrivacyNotice.tsx @@ -16,7 +16,7 @@ import { useEffect, useState } from 'react' import { Link } from 'react-router-dom' -const STORAGE_KEY = 'ngu-privacy-notice-closed' +const STORAGE_KEY = 'site-privacy-notice-closed' export default function PrivacyNotice() { const [visible, setVisible] = useState(false) diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx index f74db1f..de9937e 100644 --- a/src/components/ThemeToggle.tsx +++ b/src/components/ThemeToggle.tsx @@ -15,7 +15,7 @@ import { useEffect, useState } from 'react' type Theme = 'light' | 'dark' -export const THEME_STORAGE_KEY = 'ngu-theme' +export const THEME_STORAGE_KEY = 'site-theme' const current = (): Theme => document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light' diff --git a/src/index.css b/src/index.css index 36a9abc..44734a7 100644 --- a/src/index.css +++ b/src/index.css @@ -188,13 +188,13 @@ iframe[src*="churchcenter"] { gap: 0.25rem 1.5rem; grid-template-columns: 2fr 1fr; grid-template-areas: - "ngu image" + "org image" "info image" "desc desc"; } -.ev-ngu { - grid-area: ngu; +.ev-org { + grid-area: org; } .ev-info { @@ -217,7 +217,7 @@ iframe[src*="churchcenter"] { .ev-grid { grid-template-columns: 1fr; grid-template-areas: - "ngu" + "org" "info" "desc"; } diff --git a/src/lib/site.ts b/src/lib/site.ts index 92fe60e..0c538d2 100644 --- a/src/lib/site.ts +++ b/src/lib/site.ts @@ -4,7 +4,7 @@ What the site says about itself, for the browser: /site.json, with the admin's Site settings (Panel) laid over it. The server merges the two and writes the result into each page's HTML as - window.__NGU_SITE__ (server/src/pageMeta.js), which is read here + window.__SITE__ (server/src/pageMeta.js), which is read here before the app renders, so there's no request and no flash of the old wording. In development, or if the API is down and nginx serves the plain index.html, it isn't there and site.json alone @@ -28,7 +28,7 @@ type SiteText = { title?: string; pages?: Record; privacyEmail /* What the server wrote into the page, if it did. */ const fromServer: SiteText = - (typeof window !== 'undefined' && (window as unknown as { __NGU_SITE__?: SiteText }).__NGU_SITE__) || {} + (typeof window !== 'undefined' && (window as unknown as { __SITE__?: SiteText }).__SITE__) || {} export const SITE_NAME: string = fromServer.title || siteConfiguration.title diff --git a/src/pages/admin/AdminLayout.tsx b/src/pages/admin/AdminLayout.tsx index 5f16632..c87506c 100644 --- a/src/pages/admin/AdminLayout.tsx +++ b/src/pages/admin/AdminLayout.tsx @@ -27,7 +27,7 @@ import { AdminTitleContext } from "../../lib/adminTitle.tsx"; import { AdminWidthContext } from "../../lib/adminWidth.tsx"; import { SITE_VERSION } from "../../lib/version.ts"; import { ROLE_LABELS, isSuper } from "../../lib/roles.ts"; -import nguLogo from "../../assets/logos/NGU_Logo.svg"; +import siteLogo from "../../assets/logos/NGU_Logo.svg"; import ThemeToggle from "../../components/ThemeToggle.tsx"; import { ADMIN_HOME, @@ -220,7 +220,7 @@ export default function AdminLayout() {