main
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ad523ea0fb |
chore(typescript): move to TypeScript 7 with an ES2025 target
TypeScript 7.0 is the native compiler and ships no JavaScript API, which typescript-eslint still needs. Install both, as Microsoft documents it: - "@typescript/native": "npm:typescript@^7.0.2" gives `tsc` = 7.0 - "typescript": "npm:@typescript/typescript6@^6.0.2" gives the 6.0 API that typescript-eslint loads (its peer range stops below 6.1), and `tsc6` CI fails if `tsc` ever resolves to TypeScript 6 (@typescript/old, pulled in by the 6.0 package, ships a `tsc` too). tsconfig.json (src): - target ES2025: the newest year TypeScript 7.0, esbuild and Vite all know - lib ES2022 + DOM: the browser floor (Vite's baseline-widely-available, Chrome 111 / Safari 16.4 / Firefox 114), because nothing polyfills - baseUrl removed (gone in 7.0; paths were already relative), DOM.Iterable dropped (merged into DOM), `types: []` spelled out, erasableSyntaxOnly and verbatimModuleSyntax on (both clean) tsconfig.check.json: lib ES2025 for tests, scripts, worker and build plugins. Platform floor: the Tauri build no longer lowers to es2020; it shares the web build's baseline (the stylesheet already needed Chromium 99+ / Safari 15.4+). macOS minimumSystemVersion is 11.0 (the build is arm64). Also: eslint.config.js uses ESLint's defineConfig (tseslint.config is deprecated); THIRD_PARTY_NOTICES names the real package behind an npm alias, sorted with a shared code-unit comparator (src/utils/sort.ts); Dependabot groups typescript + @typescript/*; a test's typed-array annotation follows TypeScript 7's lib.dom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
d2100d2d40 |
ci: enforce the checks the repo already had, and close the CHANGELOG gap
CI ran typecheck/lint/locales/test/build. Everything else the repo owned was
configured but never executed — `knip` was installed and configured yet ran
nowhere, Prettier had a config and no gate, and the six version fields the
release ritual bumps by hand had nothing watching them. This wires all of it
into the pipeline.
Correctness gaps this immediately caught:
- `tsconfig.json` covers only `src`, so tests/ and scripts/ were NEVER
type-checked. Adding `tsconfig.check.json` (+ `typecheck:all`) surfaced 53
errors, including three fields silently missing from the editor→engine
parity fixture: `videoStyleEra` (v0.22.0), `adEmail` + `gameKeyEmail`
(v0.34.0), and the four `endings*` fields (v0.16.0/v0.17.1). The fixture is
the guard against exactly that class of drift, and it had drifted itself.
- `vitest.config.ts` `include` matched only `*.test.ts`, so any `.test.tsx`
would have been collected by nobody and "passed" silently. Now `{ts,tsx}`.
New gates in ci.yml: `typecheck:all`, `format:check`, `knip`, `check:version`,
and an advisory `npm audit --audit-level=high` (advisory so a fresh transitive
advisory cannot redden every unrelated PR before Dependabot opens its fix).
Plus least-privilege `permissions: contents: read` — which also clears the
`actions/missing-workflow-permissions` code-scanning alert — and a
concurrency group that cancels superseded runs everywhere except `main`.
New scripts:
- `scripts/check-version-sync.ts` — asserts all SIX version fields agree
(package.json, package-lock root AND packages[""], tauri.conf.json,
Cargo.toml, Cargo.lock self-entry). Nothing else notices a missed one, and a
stale tauri.conf.json ships an installer that disagrees with its tag.
- `scripts/generate-locale-template.ts` — `npm run generate:locale` has been
advertised in package.json and docs/I18N.md step 1 since v0.1, but the file
was never committed, so the documented first step of adding a language
failed outright. Blocks the planned pt-BR + id work.
Dead code removed: the Rust `ensure_dir` command and its two scoped `opener:`
capabilities. Its documented caller, `openSettingsFolder()`, no longer exists
in `src/` — `opener:default` (all `openExternal` needs) is untouched. Also
`@tauri-apps/plugin-opener` left knip's ignore list now that it is genuinely
imported, and `DroppedReasonId` went from unused export to typing
PlaylistPage's dropped-reason state.
Security: the `js/incomplete-url-substring-sanitization` alert in
description-builder.test.ts was a real (if low-stakes) weak assertion —
`includes("itch.io")` also matches `https://itch.io.example.com/`, so the
test could pass on the wrong line. Now matches the full URL.
CHANGELOG: v0.31.0, v0.32.0 and v0.32.1 shipped as tagged releases but were
never logged, leaving the file jumping v0.33.0 → v0.30.0. Reconstructed from
the release commits in the file's existing house style.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|