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/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/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/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/App.tsx b/src/App.tsx
index 3bd6951..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()
@@ -128,6 +128,7 @@ export default function App() {
- {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/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() {