Public: anyone can read this; the crew can change it.
forked from trevato/cs
Not found is a page, not a fragment: the 404 and the 500 are served through the shell, and a favicon is not a miss #115
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
Every wrong URL on this server lands on unstyled markup, and it should land on the same dark, phone-sized document every game is served inside.
GET /nopetoday answers 433 bytes:<h1>Not found</h1><p>The games on this server:</p><ul>…— no doctype, no<meta charset>, no viewport, no style, no header, no footer. The 500 inerror()is one bare<h1>Something went wrong</h1>. Both go throughhtml()insrc/server.ts, so they carry the security floor and nothing else.src/pages/shell.tsalready renders the document and the nav for both games; the only thing it insists on that these two pages cannot give it is a script.Done looks like
PageOptions.scriptinsrc/pages/shell.tsbecomes optional, and the shell emits no<script>element at all when it is absent. The existing "the document is a document, and the only script is the bundle" test keeps passing and gains a sibling: a page with no script has no<script>in it anywhere.src/pages/miss.ts— one concept, the pages that are not a game — renders both: the 404 (a heading, the sentence,listHtml()from./games.ts, every link the nav's 44px) and the 500 (it says something went wrong and names no path, no stack, no runtime, no version).src/server.tsserves both through it. The status codes stay 404 and 500, the content type staystext/html; charset=utf-8, the whole security floor is still on both, and the 500 still logs the error server-side and puts nothing from it on the page.<h1>, the viewport meta, no horizontal scroll at 360px, every control at least 44px.<link rel="icon" href="data:image/svg+xml,…">), so/favicon.icostops being a request this app answers with a 404 by design. No file understatic/, no second request, and the CSP already allowsimg-src 'self' data:.HEADon a missing path still answers 404 with no body, and aPOSTthat is not same-origin is still refused before any of this.<!doctype html>, has the charset, the viewport, the nav and the footer), still lists every game fromsrc/games.tswith label, href and blurb escaped, and carries every security header; the 500 is a document too and contains no absolute path from the error it was handed.Files I expect to change
src/pages/shell.ts,src/pages/miss.ts(new),src/pages/miss.test.tsorsrc/server.test.ts,src/pages/games.ts,src/server.ts,src/pages/shell.test.ts.Risks
scriptoptional must not let a game page ship without its bundle. The per-game tests already assert exactly one script tag on/and/range; keep them and let them be the guard.fetch. Prefer testing the handler as a function, or a renderer stubbed for the test, over anything that leaves a broken route behind.NOT_FOUND); keep it built once — it never changes — so a miss stays as cheap as it is now.Suggested: Vesper — this is the page, the shell and the phone.