Make the site faster to load and lighter on the server

- Every page but Home, and the whole admin, loads on first visit: the
  main bundle drops from 579 kB to 314 kB (173 to 98 kB gzipped); a
  tab on an old build reloads once when a page chunk has gone
- Home asks for events and the timeline alongside its own data, and
  the server preloads /api/front-page and the first hero photo
- Hero headline rises in as one piece (it held back the page's
  largest paint), sized to stay within two lines; min-h in dvh; first
  slide fetched at high priority
- Every raster upload gets a 640px copy (at upload, and at boot for
  older files); logos, avatars and card pictures load it and fall
  back to the full file
- Login password checks run off the event loop; only admin requests
  are logged per request; ffmpeg runs at nice 19 on Linux
- Page HTML is no-cache, so a deploy can't strand a cached page on
  missing assets; source maps are no longer linked
- Migration 042: index person_awards by award
- docs/performance.md, and gzip and HTTP/2 for nginx

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-29 02:41:45 -05:00
parent be7e92417e
commit f72a9604d2
23 changed files with 420 additions and 139 deletions

View file

@ -150,11 +150,16 @@ export function checkClip(input, source) {
/* Runs a tool, calling onLine for each line of its output, and
resolves with the tail of stderr, or rejects with it. */
function run(command, args, { onLine } = {}) {
function run(command, args, { onLine, background = false } = {}) {
return new Promise((resolve, reject) => {
let child;
// An encode takes every core it can get; at the lowest priority it
// still does, but the API and its pages come first. Linux only
// (the VPS); elsewhere it runs as it is.
const [cmd, argv] =
background && process.platform === "linux" ? ["nice", ["-n", "19", command, ...args]] : [command, args];
try {
child = spawn(command, args, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
child = spawn(cmd, argv, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
} catch (err) {
reject(err);
return;
@ -425,6 +430,7 @@ async function cut(db, job) {
args.push("-progress", "pipe:1", "-nostats", filePath(name));
await run(FFMPEG, args, {
background: true,
onLine: (line) => {
const us = line.match(/^out_time_us=(\d+)/);
if (us) update(db, job.id, { progress: Math.min(0.99, Number(us[1]) / 1e6 / length) });