Public: anyone can read this; the crew can change it.
A signed-out 404 offers Go home and Explore beside Sign in #6279
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/6244-a-signed-out-404-offers-go-home-and-expl → main 1 commit fork 1 thread · 1 unresolved
2 files
changed +11
−4
src/web/chrome.ts +7 −3
| @@ -80,9 +80,13 @@ export function notFoundPage(ctx: Ctx, opts: { plain?: boolean } = {}): Response | ||
| 80 | 80 | icon: "search", |
| 81 | 81 | title: "Nothing here", |
| 82 | 82 | note: "The page you asked for does not exist, or is not visible to you.", |
| 83 | action: offerSignIn | |
| 84 | ? btn("Sign in", { href: signInHref(ctx), variant: "primary" }) | |
| 85 | : btn("Go home", { href: "/", variant: "primary" }), | |
| 83 | action: opts.plain | |
| 84 | ? btn("Go home", { href: "/", variant: "primary" }) | |
| 85 | : offerSignIn | |
| 86 | ? html`${btn("Sign in", { href: signInHref(ctx), variant: "primary" })} | |
| 87 | ${btn("Go home", { href: "/" })} ${btn("Explore", { href: "/explore" })}` | |
| 88 | : html`${btn("Go home", { href: "/", variant: "primary" })} | |
| 89 | ${btn("Explore", { href: "/explore" })}`, | |
| 86 | 90 | })}`, |
| 87 | 91 | }, |
| 88 | 92 | 404, |
test/web-ui.test.ts +4 −1
| @@ -450,7 +450,9 @@ describe("web ui", () => { | ||
| 450 | 450 | expect(out).toContain( |
| 451 | 451 | `href="/signin?next=${encodeURIComponent(asked).replaceAll("&", "&")}"`, |
| 452 | 452 | ); |
| 453 | expect(out).not.toContain("Go home"); | |
| 453 | expect(out).toContain('href="/"'); | |
| 454 | expect(out).toContain("Go home"); | |
| 455 | expect(out).toContain('href="/explore"'); | |
| 454 | 456 | const hidden = await (await fetch(`${base}/kim/secret`)).text(); |
| 455 | 457 | const absent = await (await fetch(`${base}/kim/nothing`)).text(); |
| 456 | 458 | const scrub = (t: string) => |
| @@ -463,6 +465,7 @@ describe("web ui", () => { | ||
| 463 | 465 | expect(signedIn).toContain("Nothing here"); |
| 464 | 466 | expect(signedIn).not.toContain("/signin?next="); |
| 465 | 467 | expect(signedIn).toContain("Go home"); |
| 468 | expect(signedIn).toContain('href="/explore"'); | |
| 466 | 469 | }); |
| 467 | 470 | |
| 468 | 471 | test("safeNext refuses another origin", () => { |
new above
offline
Doc comment above notFoundPage should now mention Go home and Explore are offered on every non-plain 404.