From 29202f2eb1b3e8cec9aa477292fc1b5d3872362c Mon Sep 17 00:00:00 2001
From: Zaldimmar Pick a section to work in.
+ {children.map((child) => (
+
+
+ + Featured event +
) : feature === 'video' ? (@@ -413,3 +435,71 @@ function VideoFrame({ ) } + +/* ── Featured event ──────────────────────────────────────────── */ + +/* The event's own card for the hero: its background photo (or its + colour), then what, when and where, then its buttons and a way + to its page. The first action link is the filled button, since + it's usually Register. */ +function EventPanel({ event }: { event: HeroEvent }) { + const color = event.color || '#138ba0' + const photo = eventBackground(event.card_image) + const when = seriesLabel(event.series, event.starts_on) ?? event.date_label + const where = event.is_online && !event.location_label ? 'Online' : event.location_label + + return ( +
"{event.theme}"
} +{[when, where].filter(Boolean).join(' · ')}
+ )} + {event.tagline &&{event.tagline}
} + ++ {entry.time} +
+ +{title}
+ {(entry.location || entry.person) && ( +
+ {entry.location && {entry.location}}
+ {entry.person && (
+
+
+ {entry.detail} +
+ )} ++ {entry.person.tagline} +
+ )} +Preview
- {PREVIEWS[spec.preview](row)} + {PREVIEWS[spec.preview](row, options)}
+ }
+}
+
+/* The second leg: trade the code for tokens and check the identity.
+ Returns { sub, email, name } or throws GoogleLoginError. */
+export async function finishLogin(config, code, verifier) {
+ let res;
+ try {
+ res = await fetch(TOKEN, {
+ method: "POST",
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
+ body: new URLSearchParams({
+ code,
+ client_id: config.clientId,
+ client_secret: config.clientSecret,
+ redirect_uri: config.redirectUri,
+ grant_type: "authorization_code",
+ code_verifier: verifier,
+ }),
+ signal: AbortSignal.timeout(10_000),
+ });
+ } catch {
+ throw new GoogleLoginError("google_unreachable", "Couldn't reach Google.");
+ }
+
+ const body = await res.json().catch(() => ({}));
+ if (!res.ok || !body.id_token) {
+ console.warn(`google token exchange failed: ${res.status} ${body.error ?? ""}`);
+ throw new GoogleLoginError("google_failed", "Google didn't accept the sign-in.");
+ }
+
+ let claims;
+ try {
+ claims = JSON.parse(Buffer.from(body.id_token.split(".")[1], "base64url").toString("utf8"));
+ } catch {
+ throw new GoogleLoginError("google_failed", "Google's answer couldn't be read.");
+ }
+
+ const now = Math.floor(Date.now() / 1000);
+ if (!ISSUERS.has(claims.iss) || claims.aud !== config.clientId || !(claims.exp > now)) {
+ throw new GoogleLoginError("google_failed", "Google's answer didn't check out.");
+ }
+
+ const email = String(claims.email ?? "").toLowerCase();
+ if (!claims.email_verified || !email) {
+ throw new GoogleLoginError("unverified", "That Google account's email isn't verified.");
+ }
+ if (String(claims.hd ?? "").toLowerCase() !== config.domain || !email.endsWith(`@${config.domain}`)) {
+ throw new GoogleLoginError("wrong_domain", `Use your @${config.domain} account.`);
+ }
+
+ return { sub: String(claims.sub), email, name: claims.name ?? null };
+}
diff --git a/server/src/index.js b/server/src/index.js
index 8f8cd31..0c9a45f 100644
--- a/server/src/index.js
+++ b/server/src/index.js
@@ -76,6 +76,9 @@ app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
app.route("/api/feedback", feedback);
app.use("/api/auth/login", rateLimit({ windowMs: 15 * 60_000, max: 10 }));
+// Looser than a password guess: each Google sign-in is two requests,
+// and Google has already checked the person by the second.
+app.use("/api/auth/google/*", rateLimit({ windowMs: 15 * 60_000, max: 40 }));
app.route("/api/admin/panel", panel);
app.route("/api/auth", auth);
app.route("/api/admin", admin);
diff --git a/server/src/routes/auth.js b/server/src/routes/auth.js
index b84eba8..e2100f9 100644
--- a/server/src/routes/auth.js
+++ b/server/src/routes/auth.js
@@ -4,6 +4,10 @@
POST /api/auth/login email + password → session cookie
POST /api/auth/logout deletes the session row and cookie
GET /api/auth/me who am I, or 401
+ GET /api/auth/providers which ways in are switched on
+ GET /api/auth/google off to Google's account chooser
+ GET /api/auth/google/callback back from it: sign in, or
+ back to the login page with ?error=
Three deliberate choices:
@@ -14,18 +18,27 @@
A failed login still runs a hash. Otherwise the response time
itself says whether the account exists.
- Nothing here creates accounts. See admin-cli.js.
+ Nothing here creates accounts. See admin-cli.js. Google sign-in
+ only lets in an account that already exists: matched by its
+ linked Google id, or on first use by its email, which then links
+ it. A matching email already linked to a different Google
+ account is refused rather than relinked. googleAuth.js checks
+ the identity itself.
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
+import { deleteCookie, getCookie, setCookie } from "hono/cookie";
+
import {
+ SECURE_COOKIE,
createSession,
destroySession,
currentUser,
hashPassword,
verifyPassword,
} from "../auth.js";
+import { GoogleLoginError, finishLogin, googleConfig, startLogin } from "../googleAuth.js";
const auth = new Hono();
@@ -96,4 +109,103 @@ auth.get("/me", (c) => {
return c.json({ user }, 200, NO_STORE);
});
+
+/* ── Google ──────────────────────────────────────────────────── */
+
+// The state and PKCE verifier between the two legs. Scoped to the
+// Google routes and gone in ten minutes; Lax so it comes back on
+// the redirect from Google, which is a top-level navigation.
+const OAUTH_COOKIE = "ngu_oauth";
+const OAUTH_COOKIE_OPTIONS = {
+ httpOnly: true,
+ secure: SECURE_COOKIE,
+ sameSite: "Lax",
+ path: "/api/auth/google",
+};
+
+// Where to land afterwards: an admin page, never anywhere else.
+const safeNext = (value) =>
+ typeof value === "string" && /^\/admin(\/[\w\-/]*)?$/.test(value) ? value : "/admin/home";
+
+const backToLogin = (c, code) => c.redirect(`/admin/login?error=${encodeURIComponent(code)}`, 302);
+
+auth.get("/providers", (c) =>
+ c.json({ password: true, google: Boolean(googleConfig()) }, 200, NO_STORE),
+);
+
+auth.get("/google", (c) => {
+ const config = googleConfig();
+ if (!config) return c.json({ error: "Google sign-in isn't set up." }, 404);
+
+ const { url, state, verifier } = startLogin(config);
+ setCookie(c, OAUTH_COOKIE, JSON.stringify({ state, verifier, next: safeNext(c.req.query("next")) }), {
+ ...OAUTH_COOKIE_OPTIONS,
+ maxAge: 600,
+ });
+ return c.redirect(url, 302);
+});
+
+auth.get("/google/callback", async (c) => {
+ const config = googleConfig();
+ if (!config) return c.json({ error: "Google sign-in isn't set up." }, 404);
+
+ let saved = null;
+ try {
+ saved = JSON.parse(getCookie(c, OAUTH_COOKIE) ?? "null");
+ } catch {
+ saved = null;
+ }
+ deleteCookie(c, OAUTH_COOKIE, OAUTH_COOKIE_OPTIONS);
+
+ // Pressing Cancel on Google's screen comes back as ?error=.
+ if (c.req.query("error")) return backToLogin(c, "cancelled");
+
+ const code = c.req.query("code");
+ if (!saved?.state || !code || c.req.query("state") !== saved.state) {
+ return backToLogin(c, "expired");
+ }
+
+ let identity;
+ try {
+ identity = await finishLogin(config, code, saved.verifier);
+ } catch (err) {
+ if (err instanceof GoogleLoginError) {
+ console.warn(`google login refused: ${err.code}`);
+ return backToLogin(c, err.code);
+ }
+ throw err;
+ }
+
+ const db = c.get("db");
+ const columns = `id, email, name, role, is_active, google_sub`;
+ let user = db.prepare(`SELECT ${columns} FROM admin_users WHERE google_sub = ?`).get(identity.sub);
+
+ if (!user) {
+ const byEmail = db.prepare(`SELECT ${columns} FROM admin_users WHERE email = ?`).get(identity.email);
+ if (!byEmail) {
+ console.warn(`google login: no account for ${identity.email}`);
+ return backToLogin(c, "no_account");
+ }
+ if (byEmail.google_sub) {
+ console.warn(`google login: ${identity.email} is linked to another Google account`);
+ return backToLogin(c, "linked_elsewhere");
+ }
+ // Before linking: a refused sign-in mustn't change the account.
+ if (byEmail.is_active !== 1) return backToLogin(c, "disabled");
+ db.prepare(`UPDATE admin_users SET google_sub = ? WHERE id = ?`).run(identity.sub, byEmail.id);
+ console.log(`google account linked to ${byEmail.email}`);
+ user = byEmail;
+ }
+
+ if (user.is_active !== 1) return backToLogin(c, "disabled");
+
+ createSession(db, c, user.id);
+ db.prepare(
+ `UPDATE admin_users SET last_login_at = datetime('now'), name = COALESCE(name, ?) WHERE id = ?`,
+ ).run(identity.name, user.id);
+ console.log(`login ${user.email} (google)`);
+
+ return c.redirect(saved.next ?? "/admin/home", 302);
+});
+
export default auth;
diff --git a/src/pages/admin/AdminLogin.tsx b/src/pages/admin/AdminLogin.tsx
index 69c70a5..d03b6cf 100644
--- a/src/pages/admin/AdminLogin.tsx
+++ b/src/pages/admin/AdminLogin.tsx
@@ -5,18 +5,35 @@
page of the website; it's the door to the back office, and it
shouldn't carry a banner, a subnav, or a footer site map.
- The Google button is stubbed and disabled until the OAuth
- routes exist. It's here so the layout doesn't change when it
- starts working.
+ Google first, when the server has it set up (/auth/providers
+ says so; it's off until GOOGLE_CLIENT_ID and _SECRET are on the
+ service). It's a plain link: the server sends the browser to
+ Google and back, and a refusal comes back here as ?error=,
+ worded below. Email and password stay underneath as the way in
+ if Google is ever unavailable.
═══════════════════════════════════════════════════════════════ */
-import { useState } from "react";
-import { useLocation, useNavigate } from "react-router-dom";
+import { useEffect, useState } from "react";
+import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
import { useAuth } from "../../lib/auth.tsx";
-import { ApiError } from "../../lib/api.ts";
+import { ApiError, get } from "../../lib/api.ts";
-const GOOGLE_ENABLED = false;
+/* What a ?error= from the Google callback means, in the words the
+ person at the login page needs. */
+const GOOGLE_ERRORS: Record = {
+ cancelled: "Google sign-in was cancelled.",
+ expired: "That sign-in took too long or was already used. Try again.",
+ no_account:
+ "There's no admin account for that Google account. Ask a superadmin to add your email.",
+ linked_elsewhere:
+ "That email's admin account is linked to a different Google account.",
+ disabled: "That account has been disabled.",
+ wrong_domain: "Use your @nextgenerationofunity.org Google account.",
+ unverified: "That Google account's email isn't verified.",
+ google_unreachable: "Couldn't reach Google. Try again in a moment.",
+ google_failed: "Google sign-in didn't work. Try again, or use your password.",
+};
const fieldClass =
"w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] " +
@@ -27,9 +44,21 @@ export default function AdminLogin() {
const navigate = useNavigate();
const location = useLocation();
+ const [searchParams] = useSearchParams();
+ const googleError = searchParams.get("error");
+ const [google, setGoogle] = useState(false);
+
+ useEffect(() => {
+ get("/auth/providers", { ttl: 0 })
+ .then((data) => setGoogle(Boolean(data.google)))
+ .catch(() => setGoogle(false));
+ }, []);
+
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
- const [error, setError] = useState(null);
+ const [error, setError] = useState(
+ googleError ? (GOOGLE_ERRORS[googleError] ?? GOOGLE_ERRORS.google_failed) : null,
+ );
const [busy, setBusy] = useState(false);
const destination = location.state?.from?.pathname ?? "/admin/home";
@@ -60,7 +89,7 @@ export default function AdminLogin() {
NGU admin
- Sign in to read and triage site feedback.
+ Sign in to edit the site.
From e932ee30074c07f0a884f1a34d166396ea5638b4 Mon Sep 17 00:00:00 2001
From: Zaldimmar
Date: Sun, 27 Sep 2026 21:51:40 -0500
Subject: [PATCH 06/14] Show Google sign-in even when site.json isn't deployed
/api/auth/providers read site.json to build Google's return address,
and the deploy copies server/ into /srv/ngu-api without site.json, so
it threw and the login page hid the button. Whether Google is on now
depends only on the client id and secret; a missing return address is
logged when a sign-in starts, naming GOOGLE_REDIRECT_URI and
SITE_CONFIG. The docs say how the server is actually deployed.
Co-Authored-By: Claude Opus 5.5
---
docs/google-sign-in.md | 8 ++++++++
docs/seo.md | 7 +++++--
server/src/googleAuth.js | 18 ++++++++++++++----
server/src/routes/auth.js | 8 ++++++++
4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/docs/google-sign-in.md b/docs/google-sign-in.md
index 607f868..3d84ead 100644
--- a/docs/google-sign-in.md
+++ b/docs/google-sign-in.md
@@ -53,8 +53,16 @@ and restart. Never commit the secret or paste it into the repo:
[Service]
Environment=GOOGLE_CLIENT_ID=
Environment=GOOGLE_CLIENT_SECRET=
+Environment=GOOGLE_REDIRECT_URI=https://nextgenerationofunity.org/api/auth/google/callback
```
+`GOOGLE_REDIRECT_URI` must match the redirect URI in step 3 exactly.
+Without it the API builds it from `site.json`'s `url`, which the API only
+finds if `site.json` is deployed with it and `SITE_CONFIG` points at it
+(the deploy copies `server/` into `/srv/ngu-api`, and `site.json` lives
+at the repo root, so it isn't there by default). If neither is set,
+sign-in fails and the log says so.
+
Optional:
| Variable | Default |
diff --git a/docs/seo.md b/docs/seo.md
index 22840b4..2b719fd 100644
--- a/docs/seo.md
+++ b/docs/seo.md
@@ -29,8 +29,11 @@ with it off it blocks everything.
## Production setup
1. The API needs to find two files. Both default to the repo layout
- (`site.json` at the root, the build in `dist/`); set them on the
- `ngu-api` unit if the deploy puts them elsewhere:
+ (`site.json` at the root, the build in `dist/`), which isn't how the
+ server is deployed: the deploy copies `server/` into `/srv/ngu-api`,
+ so neither file is next to it. Copy `site.json` there with each
+ deploy (eg. rsync it to `/srv/ngu-api/site.json`) and set both on the
+ `ngu-api` unit:
```ini
[Service]
diff --git a/server/src/googleAuth.js b/server/src/googleAuth.js
index 8f59943..6baaedb 100644
--- a/server/src/googleAuth.js
+++ b/server/src/googleAuth.js
@@ -10,7 +10,9 @@
GOOGLE_CLIENT_ID from Google Cloud Console
GOOGLE_CLIENT_SECRET the same; never in the repo
- GOOGLE_REDIRECT_URI default /api/auth/google/callback
+ GOOGLE_REDIRECT_URI default /api/auth/google/callback;
+ set it when the server is deployed
+ without site.json (SITE_CONFIG)
GOOGLE_ALLOWED_DOMAIN default nextgenerationofunity.org
With no client id or secret it's off: the login page doesn't
@@ -45,10 +47,18 @@ export function googleConfig() {
const clientSecret = process.env.GOOGLE_CLIENT_SECRET;
if (!clientId || !clientSecret) return null;
- let redirectUri = process.env.GOOGLE_REDIRECT_URI;
+ // Whether Google is on depends only on the id and secret. The
+ // return address can come from site.json, which a deploy of the
+ // server alone may not have; that's reported where it's needed
+ // (the sign-in routes), rather than hiding the button.
+ let redirectUri = process.env.GOOGLE_REDIRECT_URI ?? null;
if (!redirectUri) {
- const origin = (loadSite().url ?? "").replace(/\/$/, "");
- redirectUri = `${origin}/api/auth/google/callback`;
+ try {
+ const origin = (loadSite().url ?? "").replace(/\/$/, "");
+ if (origin) redirectUri = `${origin}/api/auth/google/callback`;
+ } catch {
+ redirectUri = null;
+ }
}
return {
diff --git a/server/src/routes/auth.js b/server/src/routes/auth.js
index e2100f9..179452a 100644
--- a/server/src/routes/auth.js
+++ b/server/src/routes/auth.js
@@ -136,6 +136,14 @@ auth.get("/providers", (c) =>
auth.get("/google", (c) => {
const config = googleConfig();
if (!config) return c.json({ error: "Google sign-in isn't set up." }, 404);
+ if (!config.redirectUri) {
+ // Said in the log, where whoever runs the box will look; the
+ // person at the login page just learns it didn't work.
+ console.error(
+ "google login: no return address. Set GOOGLE_REDIRECT_URI, or SITE_CONFIG to a site.json with a url.",
+ );
+ return backToLogin(c, "google_failed");
+ }
const { url, state, verifier } = startLogin(config);
setCookie(c, OAUTH_COOKIE, JSON.stringify({ state, verifier, next: safeNext(c.req.query("next")) }), {
From 84e4e2acae1d5ae79f91447b54ed1205c72ad192 Mon Sep 17 00:00:00 2001
From: Zaldimmar
Date: Sun, 27 Sep 2026 22:15:38 -0500
Subject: [PATCH 07/14] Serve pages even when their metadata can't be built
With no site.json on the server, every page request threw and came
back as the API's JSON 500, so the site didn't load. The page route
now serves index.html as built, with the default tags, and logs the
cause once; the sitemap answers 503. The nginx snippet in docs/seo.md
also falls back to the plain page on a 500, sends the home page
through the API, and gives uploads their own body-size limit.
Co-Authored-By: Claude Opus 5.5
---
docs/seo.md | 37 ++++++++++++++++++++++++-----
server/src/routes/pages.js | 48 +++++++++++++++++++++++++++++++++-----
2 files changed, 73 insertions(+), 12 deletions(-)
diff --git a/docs/seo.md b/docs/seo.md
index 2b719fd..40b83e6 100644
--- a/docs/seo.md
+++ b/docs/seo.md
@@ -49,10 +49,24 @@ with it off it blocks everything.
so the site still loads (with default previews) during a restart:
```nginx
+ # Shared by every block that sends a page to the API.
+ # (Or repeat these lines in each block, as nginx-dev does.)
+ # proxy_http_version 1.1;
+ # proxy_set_header Host $host;
+ # proxy_set_header X-Real-IP $remote_addr;
+ # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ # proxy_set_header X-Forwarded-Proto $scheme;
+
location = /sitemap.xml {
proxy_pass http://127.0.0.1:3001;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ }
+
+ # The home page needs its own block: try_files would otherwise find
+ # the site's folder and serve index.html without asking the API.
+ location = / {
+ proxy_pass http://127.0.0.1:3001;
+ proxy_intercept_errors on;
+ error_page 500 502 503 504 = @static;
}
location / {
@@ -61,19 +75,30 @@ with it off it blocks everything.
location @page {
proxy_pass http://127.0.0.1:3001;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_intercept_errors on;
- error_page 502 503 504 = @static;
+ error_page 500 502 503 504 = @static;
}
location @static {
try_files /index.html =404;
}
+
+ # Uploads are bigger than the /api/ block's 64k limit allows.
+ location = /api/admin/media {
+ proxy_pass http://127.0.0.1:3001;
+ client_max_body_size 26m;
+ proxy_read_timeout 60s;
+ }
```
Keep the existing `/api/` and `/uploads/` blocks; they're more
- specific and still win. Use the port the API listens on.
+ specific and still win. Use the port the API listens on. A 404
+ from the API (a record that doesn't exist) goes through as it is;
+ 500 to 504 fall back to the plain page.
+
+ A dev or test server should also send `X-Robots-Tag: noindex,
+ nofollow` and its own blocking `robots.txt`, since it shares the
+ production build's settings: see `nginx-dev` in the repo root.
3. Check it: `curl -s https://nextgenerationofunity.org/events/ | grep og:title`
should show the event's name, and Facebook's Sharing Debugger or
diff --git a/server/src/routes/pages.js b/server/src/routes/pages.js
index 6684c7c..7c8905c 100644
--- a/server/src/routes/pages.js
+++ b/server/src/routes/pages.js
@@ -18,6 +18,10 @@
the app's own not-found page with a 404 status, so search engines
drop it.
+ If the metadata can't be built (no site.json at SITE_CONFIG, say),
+ the page is still served, as built, and the cause is logged once:
+ a preview is never worth a page that won't load.
+
Mounted last, after every /api and /uploads route; an unknown
/api path is still the API's JSON 404.
═══════════════════════════════════════════════════════════════ */
@@ -49,12 +53,28 @@ function indexHtml() {
const pages = new Hono();
-pages.get("/sitemap.xml", (c) =>
- c.body(sitemap(c.get("db")), 200, {
+/* Warned once per cause rather than on every request, so a missing
+ site.json doesn't bury the log. */
+const warned = new Set();
+function warnOnce(key, message) {
+ if (warned.has(key)) return;
+ warned.add(key);
+ console.error(message);
+}
+
+pages.get("/sitemap.xml", (c) => {
+ let xml;
+ try {
+ xml = sitemap(c.get("db"));
+ } catch (err) {
+ warnOnce(`sitemap:${err.message}`, `pages: can't build the sitemap: ${err.message}`);
+ return c.text("The sitemap isn't available.", 503);
+ }
+ return c.body(xml, 200, {
"Content-Type": "application/xml; charset=utf-8",
"Cache-Control": CACHE,
- }),
-);
+ });
+});
pages.get("*", (c, next) => {
const pathname = c.req.path;
@@ -70,8 +90,24 @@ pages.get("*", (c, next) => {
return c.text("The site hasn't been built.", 503);
}
- const meta = metaFor(c.get("db"), pathname);
- return c.html(renderPage(html, meta), meta.status, {
+ // The metadata is an extra. If it can't be built (site.json
+ // missing, a query failing), the page goes out as it was built,
+ // with the site's default tags, rather than not at all.
+ let meta;
+ let page;
+ try {
+ meta = metaFor(c.get("db"), pathname);
+ page = renderPage(html, meta);
+ } catch (err) {
+ warnOnce(
+ `meta:${err.message}`,
+ `pages: serving ${pathname} without its metadata: ${err.message}` +
+ (err.code === "ENOENT" ? " (set SITE_CONFIG to the deployed site.json)" : ""),
+ );
+ return c.html(html, 200, { "Cache-Control": "no-store" });
+ }
+
+ return c.html(page, meta.status, {
"Cache-Control": meta.status === 200 ? CACHE : "no-store",
});
});
From a67ca983948520c4e17dbda1bc0135f54f0a7666 Mon Sep 17 00:00:00 2001
From: Zaldimmar
Date: Sun, 27 Sep 2026 23:18:32 -0500
Subject: [PATCH 08/14] Move the NGU logos to src/assets/logos and load event
logos from uploads
The site's own logos now live in src/assets/logos. Event logos are no
longer bundled: the event cards resolve them through media.ts like
every other image, and a bare event-logo filename now means one in
the uploads directory (fall-retreat-logo.svg has been moved there by
hand). Organization logos on the cards resolve from org-logos.
Co-Authored-By: Claude Opus 5.5
---
CLAUDE.md | 2 +-
server/src/pageMeta.js | 2 +-
src/assets/Fall Logo.svg | 1 -
src/assets/event-logos/fall-retreat-logo.svg | 1 -
src/assets/event-logos/ngu-logo-white-bg.svg | 82 --------------------
src/assets/{ => logos}/NGU_Logo.svg | 0
src/assets/{ => logos}/NGU_Logo_WhiteBG.svg | 0
src/components/Footer.tsx | 2 +-
src/components/Layout.tsx | 2 +-
src/lib/media.ts | 7 +-
src/pages/admin/AdminLayout.tsx | 2 +-
src/pages/sections/EventList-Cards.tsx | 33 +++-----
12 files changed, 21 insertions(+), 113 deletions(-)
delete mode 100644 src/assets/Fall Logo.svg
delete mode 100644 src/assets/event-logos/fall-retreat-logo.svg
delete mode 100644 src/assets/event-logos/ngu-logo-white-bg.svg
rename src/assets/{ => logos}/NGU_Logo.svg (100%)
rename src/assets/{ => logos}/NGU_Logo_WhiteBG.svg (100%)
diff --git a/CLAUDE.md b/CLAUDE.md
index acb20d0..1332872 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -57,7 +57,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- `navConfig.ts` is the single source of truth for navigation, routes, and actions (header, footer, pages).
- `api.ts` is the shared caching client used by frontend data hooks.
- `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content.
-- Logos: org logos in `public/org-logos/` (served at `/org-logos/`), event logos in `public/event-logos/`. The `` component hides itself on load error.
+- Logos: org logos in `public/org-logos/` (served at `/org-logos/`); event logos are uploads (`/uploads/`, a bare filename resolves there). The site's own NGU logos are bundled from `src/assets/logos/`. Image paths resolve through `src/lib/media.ts`. The `` component hides itself on load error.
## Rules and gotchas
- **Role checks must use ladder comparisons, never equality.** Roles rank viewer → editor → admin → superadmin. Use the minimum-rank helpers from `src/lib/roles.ts` (`canWrite`, `canDelete`, `isSuper`, `atLeast`). Where a local variable shadows the name, import with an alias, e.g. `canWrite as roleCanWrite`. `role === "admin"` silently excludes higher roles and has caused repeated bugs.
diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js
index 69555fb..f47f28d 100644
--- a/server/src/pageMeta.js
+++ b/server/src/pageMeta.js
@@ -48,7 +48,7 @@ const DESCRIPTION_CHARS = 160;
/* Where a bare filename lives, per kind. Mirrors src/lib/media.ts. */
const DIRS = {
person: "/people",
- eventLogo: "/event-logos",
+ eventLogo: "/uploads",
eventBackground: "/event-backgrounds",
organization: "/org-logos",
team: "/team-logos",
diff --git a/src/assets/Fall Logo.svg b/src/assets/Fall Logo.svg
deleted file mode 100644
index 33f133f..0000000
--- a/src/assets/Fall Logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/assets/event-logos/fall-retreat-logo.svg b/src/assets/event-logos/fall-retreat-logo.svg
deleted file mode 100644
index 33f133f..0000000
--- a/src/assets/event-logos/fall-retreat-logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/assets/event-logos/ngu-logo-white-bg.svg b/src/assets/event-logos/ngu-logo-white-bg.svg
deleted file mode 100644
index 3202fa3..0000000
--- a/src/assets/event-logos/ngu-logo-white-bg.svg
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
diff --git a/src/assets/NGU_Logo.svg b/src/assets/logos/NGU_Logo.svg
similarity index 100%
rename from src/assets/NGU_Logo.svg
rename to src/assets/logos/NGU_Logo.svg
diff --git a/src/assets/NGU_Logo_WhiteBG.svg b/src/assets/logos/NGU_Logo_WhiteBG.svg
similarity index 100%
rename from src/assets/NGU_Logo_WhiteBG.svg
rename to src/assets/logos/NGU_Logo_WhiteBG.svg
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
index 21974ea..d06455e 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/NGU_Logo.svg";
+import nguLogo from "../assets/logos/NGU_Logo.svg";
import PlatformIcon from "./PlatformIcon.tsx";
const Social_Links = [
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 6b999a7..d04bf59 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -2,7 +2,7 @@ import { 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.jsx";
-import nguLogo from "../assets/NGU_Logo.svg";
+import nguLogo from "../assets/logos/NGU_Logo.svg";
import Footer from "./Footer.tsx";
/* ── Right-side nav actions ──────────────────────────────── */
diff --git a/src/lib/media.ts b/src/lib/media.ts
index 35b35f0..f7da6a9 100644
--- a/src/lib/media.ts
+++ b/src/lib/media.ts
@@ -7,7 +7,7 @@
edit rather than a grep.
⚠ Only two of these directories are confirmed by the admin help
- text: people/ and event-logos/. The other three are a guess at
+ text: people/. Event logos are uploads. The other three are a guess at
your convention. Check public/ and fix them here — nothing else
references the paths.
@@ -30,7 +30,10 @@ function inDir(dir: string) {
}
export const personPhoto = inDir('/people') // confirmed
-export const eventLogo = inDir('/event-logos') // confirmed
+// Event logos are uploads. A bare filename is one copied into the
+// uploads directory by hand (fall-retreat-logo.svg was); anything
+// uploaded through the admin is already /uploads/…
+export const eventLogo = inDir('/uploads')
export const eventBackground = inDir('/event-backgrounds')
export const orgLogo = inDir('/org-logos') // ⚠ guess
export const teamLogo = inDir('/team-logos') // ⚠ guess
diff --git a/src/pages/admin/AdminLayout.tsx b/src/pages/admin/AdminLayout.tsx
index e68b59b..2a98f84 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/NGU_Logo.svg";
+import nguLogo from "../../assets/logos/NGU_Logo.svg";
import {
ADMIN_HOME,
AREA_TITLES,
diff --git a/src/pages/sections/EventList-Cards.tsx b/src/pages/sections/EventList-Cards.tsx
index 238ab43..9fd8fd5 100644
--- a/src/pages/sections/EventList-Cards.tsx
+++ b/src/pages/sections/EventList-Cards.tsx
@@ -5,7 +5,7 @@ import { eventHref } from "../../lib/hrefs.ts";
import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts";
import { seriesLabel } from "../../lib/eventSeries.ts";
import PlatformIcon from "../../components/PlatformIcon.tsx";
-import { eventBackground, isAbsoluteMedia } from "../../lib/media.ts";
+import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } from "../../lib/media.ts";
/* ═══════════════════════════════════════════════════════════════
EVENT LIST — CARDS
@@ -27,28 +27,17 @@ import { eventBackground, isAbsoluteMedia } from "../../lib/media.ts";
nothing but retreats shows no control at all.
═══════════════════════════════════════════════════════════════ */
-const LOGO_FILES = import.meta.glob("../../assets/event-logos/*.svg", {
- eager: true,
- import: "default",
-});
-
-const LOGOS = Object.fromEntries(
- Object.entries(LOGO_FILES).map(([path, src]) => [path.split("/").pop(), src])
-);
-
-/* A bundled logo by filename, or an upload or URL as it is. */
-const logoSrc = file =>
- (file && LOGOS[file]) || (isAbsoluteMedia(file) ? file : null);
/* Last resort only. The API already falls back to the host
organization's logo when an event doesn't name its own, so this
fires only for an event with no host at all. */
const DEFAULT_ORG_LOGO = null;
-/* An
that removes itself if the file 404s. */
-function Logo({ file, alt = "", className }) {
+/* An
that removes itself if the file 404s. `src` is already
+ resolved by media.ts: an event logo from the uploads directory, an
+ organization's from org-logos, anything with a path or URL as is. */
+function Logo({ src, alt = "", className }) {
const [failed, setFailed] = useState(false);
- const src = logoSrc(file);
if (!src || failed) return null;
return (
-
+
{typeBadge}
@@ -234,7 +223,7 @@ export function Card({
)}
@@ -245,7 +234,7 @@ export function Card({
<>
-
+
{typeBadge}
@@ -263,7 +252,7 @@ export function Card({
From 9075cfb90812f0ecadddf86e7c2465297b67b529 Mon Sep 17 00:00:00 2001
From: Zaldimmar
Date: Sun, 27 Sep 2026 23:18:32 -0500
Subject: [PATCH 09/14] Show schedule maps in satellite view
Co-Authored-By: Claude Opus 5.5
---
src/components/ScheduleBlock.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/ScheduleBlock.tsx b/src/components/ScheduleBlock.tsx
index 05b6b10..d15e2d0 100644
--- a/src/components/ScheduleBlock.tsx
+++ b/src/components/ScheduleBlock.tsx
@@ -59,7 +59,7 @@ function todayIndex(days: Day[]): number {
}
const mapEmbed = (place: string) =>
- `https://maps.google.com/maps?q=${encodeURIComponent(place)}&output=embed`
+ `https://maps.google.com/maps?q=${encodeURIComponent(place)}&output=embed&maptype=satellite`
const mapLink = (place: string) =>
`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(place)}`
From 9eeb13c5ecee6c21cf2421942fc4779869c11c39 Mon Sep 17 00:00:00 2001
From: Zaldimmar
Date: Sun, 27 Sep 2026 23:20:55 -0500
Subject: [PATCH 10/14] QR tool: choose the centre, type any link, pick the
colours
The centre can be nothing, the NGU dove, or any SVG dropped into
src/assets/qr, embedded in the code so downloads carry it. "A link I
type" takes a site path (sent to the live site), a full http(s)
address, or a bare domain. The code, background and dove colours can
be changed, with a warning under 4:1 contrast or for an inverted
code, which many scanners can't read.
Co-Authored-By: Claude Opus 5.5
---
site.json | 2 +-
src/components/QrCode.tsx | 81 +++++++---
src/pages/QrCodes.tsx | 2 +-
src/pages/admin/adminNav.ts | 2 +-
src/pages/sections/QrCodeMaker.tsx | 243 ++++++++++++++++++++++++++---
5 files changed, 279 insertions(+), 51 deletions(-)
diff --git a/site.json b/site.json
index a0fc0c3..786515f 100644
--- a/site.json
+++ b/site.json
@@ -39,7 +39,7 @@
},
"/qr": {
"title": "QR Codes",
- "description": "Codes for flyers, slides and signs, pointing at any page on the site."
+ "description": "Codes for flyers, slides and signs, pointing at any page on the site or any link, in your choice of colours."
},
"/give": {
"title": "Giving",
diff --git a/src/components/QrCode.tsx b/src/components/QrCode.tsx
index e5f92d1..8ae64bf 100644
--- a/src/components/QrCode.tsx
+++ b/src/components/QrCode.tsx
@@ -1,16 +1,25 @@
/* ═══════════════════════════════════════════════════════════════
QR CODE
- A QR code as an