Finish the audit leftovers
- One mediaUrl in media.ts instead of 12 identical aliases and a kind map; orgPath builds on hrefs.ts's orgHref - One Logo component (hides itself or shows a fallback when the file is missing) for event cards, org lists and chapter marks - useHistory is a thin wrapper over useRecord - adminSchema.ts split into adminSchema/, one file per entity plus shared.ts; the registry is unchanged (checked by loading both) - JS smooth scrolls respect reduced motion (lib/motion.ts) - Content-Security-Policy in Report-Only, with /api/csp-report logging what it would block Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c74ad746f5
commit
e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions
120
src/lib/adminSchema/siteSettings.ts
Normal file
120
src/lib/adminSchema/siteSettings.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
import siteConfiguration from "../../../site.json";
|
||||
import { mediaUrl } from "../media.ts";
|
||||
|
||||
/* ── Site settings (035_site_settings.sql) ───────────────────────
|
||||
Overrides for site.json, superadmins only: every blank falls back
|
||||
to what site.json says, which is shown as the default. */
|
||||
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
|
||||
([path, page]) => [path, `${page.title} (${path})`],
|
||||
);
|
||||
|
||||
export const siteSettings = {
|
||||
key: "site_settings",
|
||||
label: "Site settings",
|
||||
singular: "site settings",
|
||||
idLabel: "Settings",
|
||||
singleton: "site",
|
||||
writeRole: "superadmin",
|
||||
|
||||
list: { columns: [], filters: [] },
|
||||
|
||||
groups: [
|
||||
{
|
||||
legend: "The site",
|
||||
note: "Anything left blank uses site.json, so the build and these settings agree until you change one.",
|
||||
fields: [
|
||||
{ path: "site_name", label: "Site name", help: `Default: ${siteConfiguration.title}` },
|
||||
{
|
||||
path: "description",
|
||||
label: "Description",
|
||||
widget: "textarea",
|
||||
full: true,
|
||||
help: "Search engines and link previews show this for pages without their own. Default: site.json's, or the front page's subhead.",
|
||||
},
|
||||
{
|
||||
path: "preview_image",
|
||||
label: "Preview image",
|
||||
widget: "image",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "Shown when a page without its own image is shared. 1200 × 630 works everywhere.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
legend: "Icons",
|
||||
fields: [
|
||||
{
|
||||
path: "favicon",
|
||||
label: "Favicon",
|
||||
widget: "image",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "The browser-tab icon: a square PNG (512px) or an SVG. Keep original when uploading an SVG.",
|
||||
},
|
||||
{
|
||||
path: "apple_touch_icon",
|
||||
label: "Home-screen icon",
|
||||
widget: "image",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "For iPhones saving the site to their home screen: a square PNG, 180px, no transparency.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
legend: "Search engines",
|
||||
fields: [
|
||||
{
|
||||
path: "indexing",
|
||||
label: "Let search engines list this site",
|
||||
widget: "select",
|
||||
options: [
|
||||
["on", "On: pages can appear in Google"],
|
||||
["off", "Off: hidden from search (use on the dev server)"],
|
||||
],
|
||||
blankLabel: `Default: site.json (${siteConfiguration.robots?.index === false ? "off" : "on"})`,
|
||||
help: "Applies to this server's database only, so dev can be off while production is on.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
legend: "Privacy",
|
||||
fields: [
|
||||
{
|
||||
path: "privacy_email",
|
||||
label: "Privacy contact email",
|
||||
help: `The Privacy page gives this for privacy questions and data requests, eg. privacy@nextgenerationofunity.org. ${
|
||||
siteConfiguration.privacyEmail ? `Default: ${siteConfiguration.privacyEmail}` : "Default: none, the page offers its request form only"
|
||||
}.`,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
children: [
|
||||
{
|
||||
key: "pages",
|
||||
label: "Page titles and intros",
|
||||
note: "Change a static page's heading and intro, which are also its search title and description. Blank fields keep site.json's.",
|
||||
addLabel: "Change a page",
|
||||
title: (row) => SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page",
|
||||
blank: { path: "", title: "", description: "" },
|
||||
fields: [
|
||||
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
|
||||
{
|
||||
path: "title",
|
||||
label: "Title",
|
||||
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
|
||||
},
|
||||
{
|
||||
path: "description",
|
||||
label: "Intro",
|
||||
widget: "textarea",
|
||||
full: true,
|
||||
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue