Public: anyone can read this; the crew can change it.

forked from trevato/cs

The reference gets an address: the weapons and damage tables become a page you can link to #289

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The weapons and damage tables now have an address of their own: `GET /weapons`, rendered by `src/pages/weapons.ts` — the module that already rendered them — so the whole reference is one link you can paste.

shipped production is serving it deploy ae07c2d

opened this

The weapons and damage tables now have an address of their own: GET /weapons, rendered by src/pages/weapons.ts — the module that already rendered them — so the whole reference is one link you can paste.

What changed. src/pages/weapons.ts gains two things beside the section it already had: weaponsPage, the whole document through the same shell every game is served inside, and weaponsSummary, what the shooter's page carries in the tables' place. src/server.ts adds one read route, outside src/games.ts because this is not a game — no bundle, no assets, no state, nothing to run — but on exactly a game's terms: its own style block hashed into its own style-src, the security floor, gzip through send, HEAD for free, and the body rendered and weighed once at start-up like the 404's, so a hit is a map lookup and a write of bytes that already exist (measured at under a millisecond against a live server).

Summary, not a closed <details>. A <details> still ships every byte of the tables to every visitor, and the shooter's page not shipping them was the point. What is left on / is four measured figures and the link — how many guns, how many thrown, what the dearest costs, and which weapons kill with one shot to a helmeted head (today: Knife, Desert Eagle, AK-47 and AWP) — all read off the same src/sheet.ts, so the teaser cannot promise what the tables do not say. The menu's hint now points at /weapons instead of #weapons, and the #weapons CSS moved out of the shooter's style block with the section.

Bytes, on an empty database, gzipped and raw: / 10,028 / 33,164 → 8,442 / 23,933; /weapons is 4,649 / 16,968 and downloads no bundle. The budgets in src/server.test.ts are / 12,000 → 10,500 and /weapons 5,600; on the suite's own filled database / measures 8,830. The two pages together are more bytes than the one was, because the shell is paid for twice — no visit pays for both.

Tests that would fail without this: the route answers 200 with every weapon in the registry and the damage table; the shooter links it and no longer contains a row, a scroll box or an assumption of it; weaponsPage handed a registry with a weapon added renders it in both tables with nobody editing the page; /weapons is in the gzip test, the style-hash loop and the byte budget. The #224 checks are untouched and still hold every digit against combat.ts. bun run test is green: 1,250 pass.

What I did not do: /weapons is not in the header's nav — that list is the registry of games, and adding a non-game to it is a shell change that belongs with #255 rather than here. The 404 likewise still lists only the games. In the preview, try /weapons, print it (⌘P) to see the paper view, and check that / still says the same numbers it links to.

🤖 Generated with Claude Code

Closes #272

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs