diff --git a/CLAUDE.md b/CLAUDE.md index f4630a0..8aa38e5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,7 +32,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu - Debugging: check `journalctl -u ngu-api -n 40 --no-pager` first. Make sure rsync ran from the repo (not the deployed copy) before restarting the service. - Never run commands against the production server or database unless explicitly asked. - Uploaded media: `UPLOADS_DIR=/var/lib/ngu/uploads`, served by nginx at `/uploads/`. Setup and the nginx block are in `docs/media-uploads.md`. -- Analytics: self-hosted Plausible, proxied by nginx at `/pa/`. The API adds its script to every page (`analyticsTag` in `server/src/pageMeta.js`), counting under the hostname of `site.json`'s `url`, so each deployment reports as itself. Nothing in `index.html` or the app. +- Analytics: self-hosted Plausible, proxied by nginx at `/pa/`. The API adds its script to every page (`analyticsTag` in `server/src/pageMeta.js`), counting under the hostname of `site.json`'s `url`, so each deployment reports as itself. Nothing in `index.html` or the app. Daily and weekly reports go to Discord when Panel → Site settings → Reports turns them on and `PLAUSIBLE_API_KEY` and `DISCORD_WEBHOOK_URL` are set (`server/src/analyticsReport.js`): `docs/analytics-reports.md`. Short links `/go/` (Data → Links/redirects, `server/src/routes/redirects.js`) count clicks, report each to Plausible as a pageview and add the link's UTM tags: `docs/redirects.md`. - Page HTML goes through the API, which fills in each page's title, description, preview image and structured data (`server/src/pageMeta.js`), and serves `/sitemap.xml`. It reads `SITE_CONFIG` (site.json) and `SITE_INDEX` (the built index.html), with Panel → Site settings (the `site_settings` table) laid over site.json, and serves `/robots.txt` from the same merge. nginx setup: `docs/seo.md`. - Video clips (Tools, admins and up): yt-dlp downloads our YouTube/Facebook videos into `CLIPS_DIR`, ffmpeg cuts them; one job at a time, files swept after a day (`server/src/clips.js`). Needs yt-dlp and ffmpeg on the VPS: `docs/video-clips.md`. - Newsletter countdown pictures: `/api/countdown/:id.png` (`server/src/routes/countdown.js`), drawn with sharp when an email is opened; it uses the VPS's fonts, so install Poppins there (eg. into `/usr/local/share/fonts`, then `fc-cache`) or it falls back to a plain sans. The social bar's icons are static files in `public/email/`. @@ -64,7 +64,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. -- Images: every record image (logos, photos, backgrounds, block images) is an upload, in a folder by use: `/uploads/logos/`, `/uploads/images/`, `/uploads/thumbnails/` (saved previews); a logo or icon image field sets `folder: "logos"` (`docs/media-uploads.md`, Folders). A bare filename resolves to `/uploads/` (`src/lib/media.ts`, and `server/src/pageMeta.js` for previews). Only the site's own chosen assets, the NGU logos in the nav, footer and admin, are bundled from `src/assets/logos/`. Logo images hide themselves on load error (`onError`). +- Images: every record image (logos, photos, backgrounds, block images) is an upload, in a folder by use: `/uploads/logos/`, `/uploads/images/`, `/uploads/thumbnails/` (saved previews), `/uploads/captions/` (videos' .vtt files); a logo or icon image field sets `folder: "logos"` (`docs/media-uploads.md`, Folders). A bare filename resolves to `/uploads/` (`src/lib/media.ts`, and `server/src/pageMeta.js` for previews). Only the site's own chosen assets, the NGU logos in the nav, footer and admin, are bundled from `src/assets/logos/`. Logo images hide themselves on load error (`onError`). ## 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. @@ -89,8 +89,8 @@ Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema/` (se - `admin-cli.js` imports `ROLES` and `destroyAllSessionsFor` from `auth.js`. Keep it that way to prevent drift. ## Migrations -- `server/src/migrations/023_schema.sql` is the baseline: the whole schema, consolidated from the old 001–023. It only runs on an empty database; the runner refuses a database between v1 and v22. It's the place to read the schema, not to change it: a database that already exists never re-runs it. -- Changes go in new sequential files after it: `024_`, `025_`, ... +- `server/src/migrations/066_schema.sql` is the baseline: the whole schema, consolidated on 2026-10-04 from the old 023–066 (generated from the live schema, so the comments are the ones inside each table). `066_seed.sql` runs right after it with the least a new database needs (single rows, event scopes, the site pages' sections, the Musicians tag); content is typed in through the admin. Both only run on an empty database; the runner refuses a database between v1 and v65 (bring it to v66 with a release from before the consolidation first). It's the place to read the schema, not to change it: a database that already exists never re-runs it. +- Changes go in new sequential files after it: `067_`, `068_`, ... - The runner may drop statements after a `BEGIN...END` trigger body. Keep triggers last in a file, and put each `CREATE VIEW` before any trigger or in its own file. - The runner turns foreign keys off around every migration (it can't be done inside the file's transaction) and runs `PRAGMA foreign_key_check` before committing, so a table rebuild needs no `PRAGMA foreign_keys` of its own. When views or triggers name the table being rebuilt, wrap the drop-and-rename in `PRAGMA legacy_alter_table = ON` ... `OFF`, then recreate the rebuilt table's own indexes and triggers. diff --git a/docs/analytics-reports.md b/docs/analytics-reports.md new file mode 100644 index 0000000..f506f05 --- /dev/null +++ b/docs/analytics-reports.md @@ -0,0 +1,162 @@ +# Analytics reports to Discord + +The API can post the site's Plausible numbers to a Discord channel +(`server/src/analyticsReport.js`, migration 065): + +- **Daily**: yesterday's visitors, pageviews, bounce rate, visit length, + and the top 3 pages and sources. +- **Weekly**, on Mondays: the last 7 days (Monday to Sunday), each + total with its change from the week before, and the top 5 pages and + sources. + +Each one has its own switch in Panel → Site settings → Reports, and both +are off until it's turned on. They go out at 8:00 in `REPORT_TZ`. If the +server is down then, they go out when it comes back up later that day. +A restart never posts the same report twice. Nothing else on the site +depends on this. + +| Setting on the `ngu-api` service | What it is | +| --- | --- | +| `PLAUSIBLE_API_KEY` | A Plausible Stats API key (step 1) | +| `DISCORD_WEBHOOK_URL` | The channel's webhook address (step 2) | +| `PLAUSIBLE_URL` | Where the API can reach Plausible. Default `http://127.0.0.1:8000` | +| `REPORT_TZ` | The time zone for "yesterday" and 8:00. Default `America/Chicago` | + +Without the first two, no reports are sent, whatever the switches say. + +## 1. The Plausible API key + +1. Sign in to Plausible (the self-hosted one behind `/pa/`) as an owner + of the site. +2. Account settings → API keys → New API key. Pick **Stats API** if it + asks for a type, and name it eg. `ngu-api reports`. +3. Copy the key now. Plausible shows it only once. + +The site has to exist in Plausible under the same domain the pages count +under: the hostname of `site.json`'s `url`, eg. `nextgenerationofunity.org` +(not `www.` and not `https://`). It already does if the dashboard shows +visits. + +The reports use the Stats API v2 (`/api/v2/query`), which needs +Plausible Community Edition 2.1 or later. Check Settings or the page +footer for the version, and upgrade an older one first. + +### Where Plausible listens + +`PLAUSIBLE_URL` is the address the API calls directly, not the public +`/pa/` path. nginx's proxy for `/pa/` already points at it: + +```sh +grep proxy_pass /etc/nginx/snippets/plausible-proxy.conf +``` + +If that shows `http://127.0.0.1:8000`, leave `PLAUSIBLE_URL` unset. +Otherwise set it to that address, eg. `http://127.0.0.1:8001`, or +`https://plausible.io` for Plausible's own hosting. + +## 2. The Discord webhook + +1. In Discord, open the channel's settings (the gear by its name) → + Integrations → Webhooks → New Webhook. +2. Name it eg. `NGU analytics`, give it an avatar if you like, and check + that it posts to the right channel. +3. Copy Webhook URL. It looks like + `https://discord.com/api/webhooks/123456789/AbCdEf...`. + +You need Manage Webhooks on the channel. Anyone who has the address can +post to the channel, so treat it as a password. + +## 3. The service + +Both values are secrets, so put them in a file only root can read +rather than in the unit itself (a `systemctl edit` override is readable +by every user on the box): + +```sh +sudo mkdir -p /etc/ngu +sudo tee /etc/ngu/analytics-reports.env >/dev/null <<'EOF' +PLAUSIBLE_API_KEY= +DISCORD_WEBHOOK_URL= +EOF +sudo chmod 600 /etc/ngu/analytics-reports.env +``` + +Add `PLAUSIBLE_URL=` or `REPORT_TZ=` lines to the same file if you need +them. Then point the service at it: + +```sh +sudo systemctl edit ngu-api +``` + +```ini +[Service] +EnvironmentFile=/etc/ngu/analytics-reports.env +``` + +systemd reads the file as root before it starts the service, so the +service's own user doesn't need to be able to read it. + +Back up the database first (migration 065 adds the switches and runs at +the next start), then: + +```sh +sudo systemctl restart ngu-api +``` + +No nginx change is needed: the API calls Plausible and Discord itself. + +## 4. Try it + +Send one straight away, whatever the switches say, while the service is +running: + +```sh +cd /srv/ngu-api +sudo bash -c 'set -a; . /etc/ngu/analytics-reports.env; set +a; + SITE_CONFIG=/srv/ngu-api/site.json DB_PATH=/var/lib/ngu/ngu.db \ + node src/analyticsReport.js daily' +``` + +`Sent the daily report.` means it's in the channel. Use `weekly` for the +weekly one. Sending one by hand doesn't stop that day's scheduled +report. + +## 5. Turn them on + +Panel → Site settings → Reports: set **Daily analytics report** and/or +**Weekly analytics report** to On, and save. Set one back to Off (or +blank) to stop it. The change counts from the next check, within 15 +minutes. + +The switches are per database, so the dev server only posts if its own +database has them on and its own service has the settings. Leave the +settings off dev, or it reports as `dev.nextgenerationofunity.org`. + +## Checking it + +Every report is logged: + +```sh +journalctl -u ngu-api --since today --no-pager | grep analytics +``` + +- `analytics daily report sent for 2026-10-05`: it went out. +- `Plausible answered 401`: the API key is wrong or was deleted. Make a + new one (step 1). +- `Plausible answered 400` or `404` naming the site: Plausible has no + site under that domain. Compare `site.json`'s `url` with the domain in + Plausible's site list. +- `Plausible answered 404` with no site named: Plausible is older than + 2.1 and has no v2 API. +- `fetch failed` or `ECONNREFUSED`: Plausible isn't at `PLAUSIBLE_URL` + (see Where Plausible listens). +- `Discord answered 401` or `404`: the webhook was deleted or the + address is wrong. Make a new one (step 2). +- Nothing at all: check that both settings are in the service's + environment (`sudo systemctl show ngu-api -p EnvironmentFiles`), that + the switch is On, that it's past 8:00 in `REPORT_TZ`, and for the + weekly report, that it's Monday. + +A failed report isn't retried that day, so a broken setup logs one line +a day, not one every 15 minutes. Fix the cause, then send it by hand +(step 4) if you still want it. diff --git a/docs/media-uploads.md b/docs/media-uploads.md index a0e025e..6e3bfdb 100644 --- a/docs/media-uploads.md +++ b/docs/media-uploads.md @@ -15,8 +15,10 @@ in the `media` table (`server/src/migrations/028_media.sql`). - **Keep original** stores the file exactly as uploaded (up to 10 MB), metadata and all. - SVGs are always kept as they are. -- Accepted types: JPEG, PNG, GIF, WebP, SVG. The type is read from the - file's contents, not its name. +- Accepted types: JPEG, PNG, GIF, WebP, SVG, and WebVTT captions + (`.vtt`, kept as they are, always in `captions/`). The type is read + from the file's contents, not its name: a captions file has to start + with `WEBVTT`. - Editors and up can upload. Admins and up can delete. The Media page shows which tables still use a file before deleting it, because nothing stops a file a record uses from being deleted. @@ -33,6 +35,7 @@ Images are kept in folders by what they're for (`FOLDERS` in | `logos/` | Uploads from logo and icon fields (organization, team, award and event logos, the favicon and home-screen icon): the fields with `folder: "logos"` in `src/lib/adminSchema/` | | `images/` | Every other upload: photos, backgrounds, covers, block images | | `thumbnails/` | Pictures the site saves by itself: link previews (Fetch preview) and Drive files' first pages | +| `captions/` | WebVTT files for uploaded videos: the Captions field of video blocks and the hero's Video captions (migration 066). YouTube, Vimeo and Facebook videos show their own | Each image's `-640.webp` small copy sits beside it. Video and audio clips (Tools → Video clips) stay in the root. The Media page and every @@ -100,3 +103,15 @@ which git ignores). The API serves `/uploads/` itself, and Vite proxies 4. `sharp` is a server dependency now: run `pnpm install` in `/srv/ngu-api` after the deploy. It ships prebuilt Linux binaries, so no build tools are needed. + +5. Captions need nginx to send `.vtt` files as `text/vtt` (Firefox + won't show them otherwise, and `nosniff` stops guessing). Check: + + ```sh + grep vtt /etc/nginx/mime.types + ``` + + If nothing comes back, add `text/vtt vtt;` inside the `types { }` + block of `/etc/nginx/mime.types`, then + `sudo nginx -t && sudo systemctl reload nginx`. Not in the site's + own file: a `types` block there replaces the whole list. diff --git a/docs/redirects.md b/docs/redirects.md new file mode 100644 index 0000000..e293bf0 --- /dev/null +++ b/docs/redirects.md @@ -0,0 +1,53 @@ +# Links/redirects + +Short links on our own domain, made in Admin → Data → Links/redirects +(editors and up), eg. `nextgenerationofunity.org/go/retreat-signup`. Use +them in the newsletter, or anywhere else, so each click is counted. + +Each link has: + +- **URL ID**: the part after `/go/`. Lowercase letters, numbers and + hyphens, and it can't be changed once made, since it's already been + sent out. +- **Goes to**: a web address (`https://...`) or a page on this site + (`/retreats`). This can be changed at any time, and every copy of the + link already sent follows it. +- **Note**: what it's for. Only we see it. +- **UTM tags** (source, medium, campaign): added to the destination's + address, eg. `?utm_source=newsletter&utm_medium=email&utm_campaign=october-2026`. + A tag the destination already has is left as it is. + +## What a click does + +`GET /go/` (`server/src/routes/redirects.js`, migration 068): + +1. Adds one to the link's **Clicks** and sets **Last click** (both on + the list page). A save in the editor never changes them. +2. Tells Plausible, as a pageview of `/go/` with the visitor's + browser and address, so it appears in Top Pages (and in the Discord + reports) like any page. A redirect never loads the page script, so + the server reports it. It uses `PLAUSIBLE_URL`, the same as the + reports (`docs/analytics-reports.md`), and needs no API key. If + Plausible can't be reached, the redirect still works and the + problem is logged once. +3. Sends the visitor on with a 302. It's never cached, so every click + reaches the server. + +An unknown URL ID shows the site's not-found page. + +## Reading the numbers + +- **Clicks** counts every request, including link checkers. Some email + security scanners open every link in a message before the reader + does, so a newsletter link can show a few clicks straight away. + Plausible leaves out known bots, so its count is usually lower and + closer to real readers. +- In Plausible, filter by page `/go/` to see every short link, or by a + UTM source or campaign to see what those visitors did once they + landed on our site. + +## Setup + +Nothing beyond the migration: nginx already sends `/go/...` to the API +through its catch-all page block (`nginx-dev`, `ngu-prod`). In +development, Vite proxies `/go` to the API (`vite.config.ts`). diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 6800fbd..757a51c 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -56,7 +56,7 @@ each entity: And the database itself holds the final word: most fixed lists are a `CHECK (... IN (...))` constraint on the column (read them in -`server/src/migrations/023_schema.sql` and any later migration). +`server/src/migrations/066_schema.sql` and any later migration). ### Two kinds of dropdown @@ -167,7 +167,7 @@ also in `server/src/admin-schema/` and a CHECK): | Entity → field | Stored values | Labeled? | Also used on the public site by | | --- | --- | --- | --- | -| Organizations → Kind (+ list filter) | national, region, group, partner, ministry | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses). A ministry has no page or list on the public site (the public routes, `pageMeta.js` and the sitemap leave it out, `ORG_KINDS` in `server/src/routes/content.js` doesn't take it); only its groups name it. `KINDS` in `src/components/admin/NewsletterRecipients.tsx` (the export's filter) lists every kind too. | +| Organizations → Kind (+ list filter) | national, region, group, partner, ministry | no, shows values | `ORG_BASE` in `src/lib/hrefs.ts` (the route each kind uses). A ministry has no page on the public site (the public routes, `pageMeta.js` and the sitemap leave it out); its groups name it, and an organization cards section lists it when asked to (below). `/organizations` returns ministries only when asked by kind or id. `KINDS` in `src/components/admin/NewsletterRecipients.tsx` (the export's filter) lists every kind too. | | Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it | | Organizations → Region areas → Edge | top, bottom | no | the group map (`OrgList-Map.tsx`) | | Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | `EVENT_TYPES` in `src/lib/eventTypes.ts` (public labels and plurals) | @@ -190,6 +190,7 @@ also in `server/src/admin-schema/` and a CHECK): | Front page → Featured cards → Card type (Community → Community blog: pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` | | Front page → Featured cards → Record type | event, organization, person, team, award | no | `FEATURED_REFS` in `server/src/shape.js` (what each fills the card with); the triggers in `030_featured_cards.sql` | | Pages → Sections → Preset | community_blog, group_map, region_list, partner_list, events, timeline, people_directory | **yes**, `PRESETS` in `src/lib/adminSchema/sitePages.ts` (which pages offer which, the list passed to each `sitePage`) | `PRESETS` in `src/pages/SitePage.tsx`. A People directory shows its tag's first `DIRECTORY_PREVIEW` people (`src/pages/sections/PeopleDirectory.tsx`), linking to `/directory/`. | +| Pages → Sections → Cards: list (organization cards preset, 067) | partner, ministry, partner,ministry | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `partner_list` in `PRESETS` in `src/pages/SitePage.tsx` passes it as the kind to `OrgListCards`; a section's hand-picked Cards: organizations (`page_section_orgs`) replace it | | Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a | "No, shows values" means the dropdown currently shows the raw value, @@ -284,14 +285,14 @@ The numbers band's "Number Source" dropdown works the same way: | The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. | | A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. | | The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. | -| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal--)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. | +| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal--)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. | | Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. | | Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. | | Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | | | Organization kind labels ("Region", "Group") | the Kind options in `src/lib/adminSchema/organizations.ts` (admin) | | | Admin account roles | `src/lib/roles.ts` (labels, notes) and `ROLES` in `server/src/auth.js` | Adding a role is also a CHECK change on `admin_users.role`. | | Admin navigation | `src/pages/admin/adminNav.ts` | | -| Newsletter parts and their defaults (Tools → Newsletter) | `PARTS_SPEC`, `PART_TYPES` and `STARTER` in `src/pages/admin/AdminNewsletter.tsx`; `PICK_DEFAULTS`, `DEFAULT_TITLE` and `COLOR` in `src/lib/newsletter.ts` | A draft is one JSON list of parts (`newsletters.layout`, 060), so adding a part or a setting needs no migration: a field in `PARTS_SPEC` and its drawing in `newsletter.ts`. The color choices are `PALETTE`; `COLOR` holds the defaults as hex, since an inbox has no theme tokens. `STARTER` is what a new draft starts with. The social bar's icons are PNGs in `public/email/` (Gmail and Outlook don't show SVG), made from `PlatformIcon.tsx` by `node scripts/email-icons.mjs`: run it again after adding a platform. A social bar with no links shows the footer's, `SOCIAL_LINKS` in `src/data/socialLinks.ts`. The countdown picture is `server/src/routes/countdown.js`, counting to local midnight in its `TIME_ZONE` (America/Chicago). | +| Newsletter parts and their defaults (Tools → Newsletter) | `PARTS_SPEC`, `PART_TYPES` and `STARTER` in `src/pages/admin/AdminNewsletter.tsx`; `PICK_DEFAULTS`, `DEFAULT_TITLE` and `EMAIL_COLOR` in `src/lib/newsletter.ts` | A draft is one JSON list of parts (`newsletters.layout`, 060), so adding a part or a setting needs no migration: a field in `PARTS_SPEC` and its drawing in `newsletter.ts`. Part colors (the title, bands, lines, card bars) are color pickers taking any hex, or the word none; `EMAIL_COLOR` holds the defaults as hex, since an inbox has no theme tokens. `STARTER` is what a new draft starts with. The social bar's icons are PNGs in `public/email/` (Gmail and Outlook don't show SVG), made from `PlatformIcon.tsx` by `node scripts/email-icons.mjs`: run it again after adding a platform. A social bar with no links shows the footer's, `SOCIAL_LINKS` in `src/data/socialLinks.ts`. The countdown picture is `server/src/routes/countdown.js`, counting to local midnight in its `TIME_ZONE` (America/Chicago). | | The live site's address (used by QR codes) | `SITE_ORIGIN` in `src/lib/site.ts` | | | Version shown on the admin home page | `src/lib/version.ts` | | | Image directories (where logos and photos are looked up) | `src/lib/media.ts` | | diff --git a/docs/video-clips.md b/docs/video-clips.md index 3faf4d2..c83f006 100644 --- a/docs/video-clips.md +++ b/docs/video-clips.md @@ -14,6 +14,12 @@ it: **Save to library** and **Save to Drive** on the download itself. It stays on the server to cut clips from either way (until the day's sweep). +The same tools take stills: a video featured card's Image field has +**Frame at** (editors and up), which saves the frame at a typed time to +`/uploads/thumbnails/` (`grabFrame` in `server/src/clips.js`). It +downloads only that frame, outside the queue. A link's own `t=` (eg. +`?t=83`) fills in the time. + Clips queue and run one at a time. A finished clip is deleted from the server once it's downloaded, unless **Save to library** is pressed first, which puts it in the media library as an upload (usable as a featured diff --git a/index.html b/index.html index b395471..c2ba150 100644 --- a/index.html +++ b/index.html @@ -5,20 +5,13 @@ <!-- site:title --> - -