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() {