Files
youtube-generator/public/404.html
T
poli0981andClaude Opus 5.5 5ced6b4a86 feat(web): Turnstile gate, in-site legal pages and clean URLs on ytgenerator.stream
A Worker (worker/) now sits in front of the static build, configured from the
same wrangler.jsonc. Cloudflare builds and deploys it; nothing in GitHub
Actions does.

Gate
- First visit shows a branded check page (8 languages, Accept-Language) with
  Cloudflare Turnstile. The token is verified server-side against
  TURNSTILE_SECRET: success, hostname, action "enter", age <= 300 s. Only
  Cloudflare's own test-key results skip the hostname/action check, so
  `npm run cf:dev` works with the published test keys.
- Pass -> `__Host-ytg_gate` (HttpOnly, Secure, SameSite=Lax, 24 h): an HMAC
  over expiry + a user-agent hash, keyed from the Turnstile secret, so no
  second secret exists and a cookie copied into a scraper is useless.
- The page reloads in place instead of redirecting, so there is no `next`
  parameter to open-redirect with; /__gate/status lets the page tell a
  cookie-blocking browser what is wrong instead of looping; after one
  failure it waits for a click rather than resubmitting.
- Missing secret = deployment mistake: the site stays up without the gate and
  the Worker logs it, instead of locking every visitor out.
- The agree box on the gate records `ytg_terms`, which the app reads on boot
  so web visitors meet one blocking screen, not two.

Headers and static files
- worker/headers.ts sets CSP (nonce + strict-dynamic on the gate, no script
  at all on legal pages), nosniff, Referrer-Policy, Permissions-Policy, COOP,
  CORP, X-Frame-Options on everything the Worker returns; _headers covers
  the files served directly; a test keeps the two baselines identical.
- `not_found_handling: "404-page"` (a static 404.html) instead of the SPA
  fallback, which would have handed index.html past the gate for any
  excluded path. The Worker serves the shell itself by fetching "/" - not
  "/index.html", which html_handling would 307 back to the home page.
- security.txt (RFC 9116) is generated per build so Expires stays ~6 months
  ahead; the Web Analytics beacon is injected into the web build only.
- theme-init.js applies the saved theme before first paint (no inline script).

Legal in-site
- build-plugins/legal-docs.ts renders TERMS, PRIVACY, DISCLAIMER (+ vi),
  LICENSE, THIRD_PARTY_NOTICES, SECURITY, NOTICE and CODE_OF_CONDUCT at build
  time into static /legal pages (public, before the gate) and a lazy
  `virtual:legal-docs` module for the in-app Legal Center, which works
  offline on desktop and Android and never leaves the webview.
- PRIVACY, TERMS and SECURITY rewritten for Cloudflare hosting, Turnstile,
  Web Analytics and the two cookies; contacts moved to the poli0981.dev
  aliases (privacy@, legal@, dmca@, copyright@, security@, code@).
- CURRENT_TERMS_VERSION 1 -> 2: the Privacy Policy changed materially.

App
- Web uses BrowserRouter (real paths; analytics can count them), Tauri keeps
  HashRouter; old /#/x bookmarks are rewritten to /x before the router reads
  them. Consent is a layout route; /legal sits outside it.
- <html lang> follows the UI language; a stale chunk after a deploy triggers
  one reload instead of an error page.

.gitattributes pins LF everywhere so Windows checkouts stop failing Prettier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 19:26:40 +07:00

58 lines
2.6 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="dark light" />
<meta name="robots" content="noindex" />
<title>Page not found — YTDescGen</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<style>
:root {
color-scheme: dark light;
--bg: #0b0b12;
--card: #13131c;
--border: #262636;
--text: #ececf3;
--muted: #9a9ab0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
:root { --bg: #f6f6fb; --card: #fff; --border: #e3e3ee; --text: #16161f; --muted: #5d5d72; }
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px 16px;
background: var(--bg);
color: var(--text);
}
main {
max-width: 420px;
text-align: center;
background: var(--card);
border: 1px solid var(--border);
border-radius: 20px;
padding: 32px 24px;
}
svg { width: 48px; height: 48px; }
p.code { margin: 16px 0 4px; font: 700 44px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -0.02em; }
h1 { font-size: 18px; margin: 8px 0; }
p { color: var(--muted); font-size: 14px; line-height: 1.55; }
a.btn { display: inline-block; margin-top: 12px; padding: 10px 18px; border-radius: 12px; color: #fff; font-weight: 600; text-decoration: none; background: linear-gradient(135deg, #6366f1, #a855f7); }
a.btn:focus-visible { outline: 2px solid #a5a6fb; outline-offset: 2px; }
</style>
</head>
<body>
<main>
<svg viewBox="0 0 512 512" aria-hidden="true"><defs><linearGradient id="g" x1="40" y1="24" x2="472" y2="488" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#6366F1"/><stop offset="1" stop-color="#A855F7"/></linearGradient></defs><rect width="512" height="512" rx="120" fill="url(#g)"/><path d="M176 118c0-17.9 19.4-29.1 34.9-20.1l128.2 74c15.5 9 15.5 31.2 0 40.2l-128.2 74C195.4 295.1 176 283.9 176 266z" fill="#fff"/><rect x="136" y="322" width="240" height="32" rx="16" fill="#fff" fill-opacity=".92"/><rect x="136" y="374" width="160" height="32" rx="16" fill="#fff" fill-opacity=".6"/></svg>
<p class="code">404</p>
<h1>This page doesn't exist</h1>
<p>The link may be old or mistyped. YTDescGen itself lives at the home page.</p>
<a class="btn" href="/">Open YTDescGen</a>
</main>
</body>
</html>