Files
youtube-generator/src/styles/globals.css
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

222 lines
4.9 KiB
CSS

@import "tailwindcss";
/*
* Tailwind 4 is configured in CSS, not `tailwind.config.ts` — the file is gone.
*
* Two things replace it:
* @custom-variant dark — the project toggles a `.dark` / `.light` class on
* <html> rather than following the OS, so the default
* `prefers-color-scheme` variant would be wrong.
* @theme — the design tokens, which now generate the utility
* classes directly (bg-surface-1, text-text-muted…).
*
* The palette itself still lives in the plain `:root` / `.light` blocks below,
* because those are what the theme *toggle* rewrites at runtime. `@theme` maps
* Tailwind's names onto those variables; it does not own the values.
*/
@custom-variant dark (&:where(.dark, .dark *));
@theme {
--color-surface-0: var(--surface-0);
--color-surface-1: var(--surface-1);
--color-surface-2: var(--surface-2);
--color-surface-3: var(--surface-3);
--color-border: var(--border);
--color-border-strong: var(--border-strong);
--color-text-primary: var(--text-primary);
--color-text-secondary: var(--text-secondary);
--color-text-muted: var(--text-muted);
--color-accent: var(--accent);
--color-accent-hover: var(--accent-hover);
--color-accent-muted: var(--accent-muted);
--color-success: var(--success);
--color-warning: var(--warning);
--color-danger: var(--danger);
--font-sans: var(--font-sans-stack);
--font-mono: var(--font-mono-stack);
--spacing-touch: 44px;
}
:root {
/* Dark theme (default) */
--surface-0: #0a0a0b;
--surface-1: #141416;
--surface-2: #1e1e22;
--surface-3: #28282e;
--border: #2a2a30;
--border-strong: #3a3a42;
--text-primary: #e8e8ed;
--text-secondary: #a0a0ab;
--text-muted: #6b6b76;
--accent: #6366f1;
--accent-hover: #818cf8;
--accent-muted: rgba(99, 102, 241, 0.15);
--success: #22c55e;
--warning: #eab308;
--danger: #ef4444;
--font-sans-stack: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
--font-mono-stack: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
}
.light {
--surface-0: #ffffff;
--surface-1: #f8f8fa;
--surface-2: #f0f0f4;
--surface-3: #e8e8ed;
--border: #d4d4db;
--border-strong: #b0b0bb;
--text-primary: #1a1a1f;
--text-secondary: #4a4a55;
--text-muted: #8a8a96;
--accent: #4f46e5;
--accent-hover: #6366f1;
--accent-muted: rgba(79, 70, 229, 0.1);
--success: #16a34a;
--warning: #ca8a04;
--danger: #dc2626;
}
body {
@apply bg-surface-0 text-text-primary font-sans;
margin: 0;
min-height: 100vh;
}
/* Scrollbar styling */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
@apply bg-surface-0;
}
::-webkit-scrollbar-thumb {
@apply bg-surface-3 rounded-full;
}
::-webkit-scrollbar-thumb:hover {
@apply bg-border-strong;
}
/*
* Legal Center documents (src/pages/LegalPage.tsx). The HTML is rendered at
* build time from the repo's Markdown, so it arrives as bare elements that
* utility classes cannot reach — style them by descendant here instead.
*/
.legal-prose {
color: var(--text-secondary);
font-size: 0.9375rem;
line-height: 1.7;
overflow-wrap: anywhere;
}
.legal-prose h1 {
color: var(--text-primary);
font-size: 1.5rem;
font-weight: 600;
line-height: 1.3;
margin: 0 0 0.75rem;
}
.legal-prose h2 {
color: var(--text-primary);
font-size: 1.125rem;
font-weight: 600;
margin: 2rem 0 0.625rem;
padding-top: 0.75rem;
border-top: 1px solid var(--border);
}
.legal-prose h3 {
color: var(--text-primary);
font-size: 1rem;
font-weight: 600;
margin: 1.5rem 0 0.5rem;
}
.legal-prose p,
.legal-prose ul,
.legal-prose ol,
.legal-prose table,
.legal-prose pre,
.legal-prose blockquote {
margin: 0 0 1rem;
}
.legal-prose ul,
.legal-prose ol {
padding-left: 1.25rem;
}
.legal-prose ul {
list-style: disc;
}
.legal-prose ol {
list-style: decimal;
}
.legal-prose li + li {
margin-top: 0.25rem;
}
.legal-prose a {
color: var(--accent);
text-decoration: underline;
text-underline-offset: 2px;
}
.legal-prose strong {
color: var(--text-primary);
}
.legal-prose code {
font-family: var(--font-mono-stack);
font-size: 0.85em;
background: var(--surface-2);
border-radius: 0.375rem;
padding: 0.1em 0.35em;
}
.legal-prose pre {
background: var(--surface-2);
border-radius: 0.75rem;
padding: 1rem;
overflow-x: auto;
font-size: 0.8125rem;
line-height: 1.55;
}
.legal-prose pre code {
background: none;
padding: 0;
}
.legal-prose pre.plain {
white-space: pre-wrap;
}
.legal-prose table {
display: block;
overflow-x: auto;
border-collapse: collapse;
font-size: 0.875rem;
}
.legal-prose th,
.legal-prose td {
text-align: left;
vertical-align: top;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--border);
}
.legal-prose th {
color: var(--text-primary);
font-weight: 600;
}
.legal-prose blockquote {
border-left: 3px solid var(--accent);
padding-left: 1rem;
color: var(--text-muted);
}