Write the site in US English
color, center, canceled, labeled, recognize and the rest, in UI text, help text, comments, docs and names (ColorInput, QrCenter). Migration 053 renames the two Site settings color CHECKs, whose names are the messages the admin shows. Kept: events.status's stored value 'cancelled' (shown as canceled), aria-labelledby, schema.org's EventCancelled, and old migrations as they ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
38aff34c97
commit
2ad65cdc15
60 changed files with 182 additions and 148 deletions
|
|
@ -21,7 +21,7 @@
|
|||
refuses create and delete (see front_page)
|
||||
check (db, id) => void, run after a save has written
|
||||
everything, inside its transaction: throw an
|
||||
HttpError to refuse it (site settings' colours)
|
||||
HttpError to refuse it (site settings' colors)
|
||||
|
||||
Replacing children wholesale is only safe because nothing has a
|
||||
foreign key INTO these tables. That is the dividing line, and
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export const featuredCardsChild = (ownerKind) => ({
|
|||
],
|
||||
});
|
||||
|
||||
/* The two polymorphic collections, parameterised by owner_kind. */
|
||||
/* The two polymorphic collections, parameterized by owner_kind. */
|
||||
export const linksChild = (ownerKind) => ({
|
||||
key: "links",
|
||||
table: "links",
|
||||
|
|
@ -189,12 +189,12 @@ export const blocksChild = (ownerKind) => ({
|
|||
one with both selects filled, and that comes back keyed to the
|
||||
row like any other field error.
|
||||
|
||||
Not parameterised the way links and blocks are: this table is
|
||||
Not parameterized the way links and blocks are: this table is
|
||||
events-only, and the owner column says so.
|
||||
|
||||
sort_order isn't declared. The engine writes it from the row's
|
||||
position because `order` is "sort_order", which is what makes
|
||||
the first row the one v_events takes the logo and colour from. */
|
||||
the first row the one v_events takes the logo and color from. */
|
||||
export const hostsChild = {
|
||||
key: "event_hosts",
|
||||
table: "event_hosts",
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ async function cut(db, job) {
|
|||
const { width, height } = await probe(input);
|
||||
if (width && height) {
|
||||
// Crop the source to the shape. The focus is where along the
|
||||
// cropped direction the frame is centred (0 left/top, 1
|
||||
// cropped direction the frame is centered (0 left/top, 1
|
||||
// right/bottom); even sizes, as the H.264 encoder needs.
|
||||
let w = width;
|
||||
let h = height;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export function migrate(db, { log = console.log } = {}) {
|
|||
throw new Error(`${file} leaves ${orphans.length} foreign key violation(s): ${where}`);
|
||||
}
|
||||
|
||||
// Not parameterisable, but version is a validated integer.
|
||||
// Not parameterizable, but version is a validated integer.
|
||||
db.exec(`PRAGMA user_version = ${version}`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
which also drops its metadata, camera location included.
|
||||
`keepOriginal` stores the bytes exactly as uploaded instead,
|
||||
under the tighter KEEP_MAX_BYTES. An SVG is always kept as it
|
||||
is: it's already small, and rasterising it would lose the point
|
||||
is: it's already small, and rasterizing it would lose the point
|
||||
of it.
|
||||
|
||||
Names are random, so two uploads of "logo.png" can't collide
|
||||
|
|
|
|||
34
server/src/migrations/053_us_spelling.sql
Normal file
34
server/src/migrations/053_us_spelling.sql
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 053 US SPELLING IN MESSAGES
|
||||
--
|
||||
-- The site is written in US English now. Two of 041's CHECKs are
|
||||
-- named with the sentence the admin shows when a save breaks them
|
||||
-- (admin-crud.js), and those said "colour"; the table is rebuilt to
|
||||
-- rename them, the same columns and rows as before.
|
||||
--
|
||||
-- events.status keeps the value 'cancelled': it's stored data, and
|
||||
-- the admin and the pages show it as "canceled".
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
CREATE TABLE site_setting_colors_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
settings_id TEXT NOT NULL REFERENCES site_settings (id) ON DELETE CASCADE,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
token TEXT NOT NULL CHECK (token IN (
|
||||
'ink', 'body', 'muted', 'link', 'brand', 'action', 'action-hover',
|
||||
'surface', 'tint', 'tint-soft', 'danger', 'danger-tint')),
|
||||
light TEXT CONSTRAINT "A color must be written #rrggbb, eg. #0f7183."
|
||||
CHECK (light IS NULL OR (length(light) = 7 AND light GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
|
||||
dark TEXT CONSTRAINT "A dark color must be written #rrggbb, eg. #5ccbdc."
|
||||
CHECK (dark IS NULL OR (length(dark) = 7 AND dark GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
|
||||
UNIQUE (settings_id, token)
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO site_setting_colors_new (id, settings_id, sort_order, token, light, dark)
|
||||
SELECT id, settings_id, sort_order, token, light, dark
|
||||
FROM site_setting_colors;
|
||||
|
||||
PRAGMA legacy_alter_table = ON;
|
||||
DROP TABLE site_setting_colors;
|
||||
ALTER TABLE site_setting_colors_new RENAME TO site_setting_colors;
|
||||
PRAGMA legacy_alter_table = OFF;
|
||||
|
|
@ -105,7 +105,7 @@ export function siteFor(db) {
|
|||
index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
|
||||
},
|
||||
privacyEmail: row.privacy_email || base.privacyEmail || "",
|
||||
// The admin's colours (theme.js): only #rrggbb values and fixed
|
||||
// The admin's colors (theme.js): only #rrggbb values and fixed
|
||||
// text, so safe inside <style>.
|
||||
themeCss: themeCss(db),
|
||||
pages,
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ auth.get("/google/callback", async (c) => {
|
|||
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");
|
||||
if (c.req.query("error")) return backToLogin(c, "canceled");
|
||||
|
||||
const code = c.req.query("code");
|
||||
if (!saved?.state || !code || c.req.query("state") !== saved.state) {
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ clips.get("/clips/:id/download", async (c) => {
|
|||
return streamFile(c, file, {
|
||||
type: audio ? "audio/mpeg" : "video/mp4",
|
||||
attachment: `${stem}-${job.id}.${audio ? "mp3" : "mp4"}`,
|
||||
// Only once the whole file has been read out: a cancelled
|
||||
// Only once the whole file has been read out: a canceled
|
||||
// download keeps it for another try.
|
||||
onComplete: () =>
|
||||
forgetDownloaded(db, job).catch((err) => console.warn(`clips: couldn't delete ${job.file}: ${err.message}`)),
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
An event's hosts are a list, in billing order, and each one is
|
||||
either an organization or a person, `kind` says which, and
|
||||
`org_kind` is there for the three organization routes. The
|
||||
first is the one the colour and logo fell back to, which is why
|
||||
first is the one the color and logo fell back to, which is why
|
||||
order is data and not a display choice.
|
||||
|
||||
Two things the team and award routes deliberately don't do:
|
||||
|
|
@ -439,7 +439,7 @@ function attachAwards(db, orgs) {
|
|||
|
||||
/* ── Events ────────────────────────────────────────────────────
|
||||
Flat, with the event scopes alongside. Retreats.tsx owns the
|
||||
band titles and colours and filters this list by scope_id.
|
||||
band titles and colors and filters this list by scope_id.
|
||||
|
||||
Oldest first, undated last. The carousel shows the list as it
|
||||
comes and opens on the first upcoming event, so past events
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
FEEDBACK ROUTE: the only public write on the site
|
||||
|
||||
Everything hostile that will ever reach this service arrives
|
||||
here, so the defences live here rather than being sprinkled
|
||||
here, so the defenses live here rather than being sprinkled
|
||||
around:
|
||||
|
||||
rate limit applied where this router is mounted (5/min)
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
rows, and for awards only public citations to published people
|
||||
(an award's page names its recipients whether they're listed or
|
||||
not, so the count does too). A count
|
||||
that disagreed with the page it summarises would be worse than
|
||||
that disagreed with the page it summarizes would be worse than
|
||||
none. 'manual' and 'years_since' read the row's own value.
|
||||
|
||||
── Countdown ──
|
||||
The pinned event if it is still published and not over, listed
|
||||
or not; otherwise the next published, listed, non-cancelled
|
||||
or not; otherwise the next published, listed, non-canceled
|
||||
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
||||
so a running series with a start date in the past still counts.
|
||||
The client works out the next meeting of a series from `series`.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
to MAX_FILES attachments. Stored as a feedback row of type
|
||||
'content' (046_content_requests.sql), files in Google Drive.
|
||||
|
||||
The same defences as the feedback route (honeypot, length caps,
|
||||
The same defenses as the feedback route (honeypot, length caps,
|
||||
a rate limit where it's mounted), plus: files are judged by their
|
||||
first bytes, not the name or type the browser claims, and nothing
|
||||
goes to Drive until everything else has passed.
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ const ALL_BLOCKS = [
|
|||
];
|
||||
|
||||
/* A record page's body: a handful of types, so it reads like a
|
||||
real page rather than a catalogue. */
|
||||
real page rather than a catalog. */
|
||||
const pageBody = (what) => [
|
||||
["heading", { text: `About this ${what}` }],
|
||||
["paragraph", { text: `This is **showcase data** for a ${what} page. Every field on the record is filled in, so anything left blank on the page is something the page doesn't draw.\n\nSee the [content block showcase](/blog/${POST_ID}) for every block type.` }],
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
THEME
|
||||
|
||||
The admin's palette (Panel → Site settings → Colours, table
|
||||
site_setting_colors) over the site's own colour tokens.
|
||||
The admin's palette (Panel → Site settings → Colors, table
|
||||
site_setting_colors) over the site's own color tokens.
|
||||
|
||||
The defaults are THEME_DEFAULTS (themeDefaults.js), which the
|
||||
build checks against src/index.css. A blank override keeps the
|
||||
|
|
@ -117,6 +117,6 @@ export function checkTheme(db) {
|
|||
}
|
||||
}
|
||||
if (problems.length) {
|
||||
throw new HttpError(422, `These colours would be hard to read: ${problems.join("; ")}.`);
|
||||
throw new HttpError(422, `These colors would be hard to read: ${problems.join("; ")}.`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
THEME DEFAULTS
|
||||
|
||||
The site's own colour tokens, light and dark: the one list both
|
||||
The site's own color tokens, light and dark: the one list both
|
||||
the server (theme.js: contrast check, overrides) and the admin
|
||||
(Site settings → Colours: defaults shown) read. No imports, so the
|
||||
(Site settings → Colors: defaults shown) read. No imports, so the
|
||||
browser bundle can take it too.
|
||||
|
||||
src/index.css holds the same values as CSS (@theme and its dark
|
||||
block), since CSS can't import this. The build checks the two
|
||||
agree and stops if they don't (themeDefaultsCheck in
|
||||
vite.config.ts). Change a colour here and there together.
|
||||
vite.config.ts). Change a color here and there together.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
// light dark
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue