Commit Graph
13 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 886d25b588 fix(quality): clear the 44 open SonarCloud issues
Regexes with super-linear backtracking (S8786 x16) are rewritten to stay
linear on long runs; each new pattern gives the same results as the old one
on 150k-450k fuzzed inputs (except where noted) and finishes adversarial
50k-character inputs in under 3 ms:
- tag-generator QUALIFIER_SUFFIX_RE starts just before a `:`/space run
  (`(^|[^:\s])…` + "$1"), never inside one
- timeline-parser matches `line.trimEnd()` with a greedy label, and renders
  with trimEnd(); cleanCpuName collapses whitespace before the patterns
- editor-store endings, Google Play urlPattern (lookahead for `id=`),
  channel-phrase punctuation, SPDX OR/AND split, legal-docs slug and link
  stripping (link text/URL may not contain `[`), base64url padding, and a
  loop for trailing slashes in the worker router

Others:
- S2871: sorts take the shared code-unit comparator (same order as before;
  THIRD_PARTY_NOTICES is unchanged)
- S4822: ErrorBoundary catches the logger import with .catch(), which a
  try/catch never could
- S3516: migrateProfilesState returns a new object
- S7773: Number.parseInt (x10)
- S9379: Modal takes an initialFocusRef (Radix onOpenAutoFocus), so the
  shortcut search box gets focus without an autoFocus attribute
- S2245: generateId drops the Math.random fallback; getRandomValues exists
  everywhere the app runs, and a non-random ID is worse than an error
- S4036: NOSONAR on the dev script's `git` call (PATH lookup by design)
- S6505/S8543: every workflow installs with `npm ci --ignore-scripts`, and CI
  runs `npm run cf:check` instead of `npx wrangler …`
- S6358: Android sets allowBackup="false" — app data is no longer copied to
  Google Drive backups; Backup & Restore moves it to a new phone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 15:05:16 +07:00
poli0981andClaude Opus 5.5 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>
2026-10-22 14:48:21 +07:00
poli0981andClaude Opus 5.5 261457ae38 chore(legal): sync notices, REUSE and privacy with the code
- THIRD_PARTY_NOTICES said the app uses the operating system's fonts; it
  bundles Inter and JetBrains Mono (OFL-1.1). The Rust table claimed to
  list the direct dependencies of src-tauri but only took names starting
  with "tauri", so serde was missing. The generator now reads Cargo.toml's
  dependency tables and fails on a crate whose license it doesn't know.
- REUSE.toml credited the Gradle wrapper to the project; it is Gradle's
  ("the original author or authors", Apache-2.0).
- The Privacy Policy lists the session-only ytdescgen-chunk-reload flag
  next to the localStorage keys. Not a material change, so the terms
  version stays 2; the Effective date moves.
- DISCLAIMER (+ vi) pointed at a THIRD_PARTY_NOTICES section by an old
  heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 22:00:02 +07:00
poli0981andClaude Opus 5.5 38f47add8b chore(legal): keep copyright years current, checked in CI
Every notice already says 2026, which is right: the first commit is from
2026-04-07, so there is no 2025 to fix and no 2025-2026 range to claim.
What was missing is anything keeping the years current.

- src/config/brand.ts: COPYRIGHT_START_YEAR and copyrightYears(), "2026"
  now and "2026-2027" from the first commit made in 2027
- npm run check:copyright (CI, next to check:licenses) holds NOTICE,
  REUSE.toml and the installers' copyright string to HEAD's commit year,
  not the clock, so old commits stay green; npm run update:copyright
  rewrites them
- tauri.conf.json gains bundle.copyright, so the .exe/NSIS, macOS and
  Linux packages stop shipping an empty copyright field
- the /legal pages' footer prints the same range at build time

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 09:13:52 +07:00
poli0981andClaude Opus 5.5 5b61533465 docs: refresh the technical and feature docs for v1.0.0
Every claim checked against the code.

- TECH-SPEC: current configs (React 19 / Vite 8 / Tailwind 4, the web vs
  Tauri build), Cloudflare hosting and the Worker, store versions and
  migrations, the backup format, engine rules added in 1.0, CI as it is.
- ARCHITECTURE: layers, web vs Tauri, routing and start-up, the engine,
  state, backup & restore, web delivery, the hardened Tauri shell.
- PACKAGING: tauri.conf and capabilities as shipped, the eleven
  name-only commands and what they guard, where desktop data lives, the
  first-start recovery of pre-1.0 files, the release workflows; the
  auto-update flow that never existed is gone.
- FEATURES, CONTENT-INVENTORY (+ vi): recounted from config (42 genres,
  16 store entries, 22 social/donate fields, 7 cross-post platforms,
  37 Vietnamese banks); shortcuts that never existed removed.
- DEVELOPMENT (+ vi): main-only branching, every npm script, Rust 1.90,
  Cloudflare local dev with test keys, the Rust checks.
- I18N: both namespaces and all seven registration places, including
  the check page's own language list; ROADMAP: v1.0.0 shipped + backlog.
- DISCLAIMER (vi): eight languages. The locale template script now
  prints the full registration checklist; a stale comment in main.tsx
  about the removed settings file is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 23:29:10 +07:00
poli0981andClaude Opus 5.5 3912ca5152 feat(data): backup & restore with preview and undo; desktop files by name only
Storage (desktop):
- The webview can no longer name a path. Five commands that read, wrote,
  listed and deleted any path the frontend sent are replaced by name-only
  commands (backups, logs) that resolve under the app data folder, and by
  export/import commands that open the native dialog from Rust, so the only
  file touched is the one the user picked (json/jsonl/txt/csv/md, 20 MB).
  The fs and shell plugins are removed (Rust, npm, capabilities).
- The settings "mirror" file is gone: it was written next to the data
  folder (a missing path separator) and never read back. On first start
  the file becomes a restorable backup — never applied on its own — and
  the stray log folder is merged into the right one.
- Automatic backups on desktop: after library changes (quiet 30 s, at most
  every 10 min, skipped when unchanged or empty), newest ten kept, plus one
  before every restore. Settings lists them with Restore.
- One tray icon, built in code with the app icon (the config entry that
  could add a second, iconless one is removed).

Backup & restore (every platform):
- Format 2 files carry each section's store version; imports run the
  stores' own migrations (now exported functions), then a whitelist
  sanitizer: known fields and values only, editor limits, safe unique ids.
- Reads every earlier export: v0.15-v0.38 envelopes (log exports were
  labelled "history"), pre-v0.15 bare arrays, the old desktop data file.
- Restore dialog: new / already here / different per item, merge (keep the
  newer one, or both) or replace, section and item selection, one step,
  Undo. Newer-version sections are shown, not restored.
- Settings: Back up (choose sections) / Restore / drop a file. Consent and
  panel state are never exported or overwritten.
- History export as CSV (spreadsheet-safe) or JSON; logs export as "logs";
  dated file names; no more 250 ms timer guessing that a picker was
  cancelled.

Library:
- Templates save every editor field; presets save store link types and the
  other per-game fields; profiles save donate, community links and the
  custom graphics preset. Edit forms can update from the current editor,
  start fresh each time they open, and save on Enter. Toasts translated.

Dev: Vite no longer watches src-tauri (cargo's locked .dll crashed
`tauri dev` on Windows).

Verified in `tauri dev` on Windows under a test identifier: legacy file
recovered, old logs merged, auto backup, restore from the legacy backup
with a backup before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:05:12 +07:00
poli0981andClaude Opus 5.5 a70580e703 ci: security, licensing and style gates; pin every action by SHA
New checks
- security.yml: dependency-review blocks PRs that add a high/critical
  advisory; actionlint + zizmor lint the workflows themselves (template
  injection, permissions, credential persistence, unpinned uses); OpenSSF
  Scorecard weekly and on main (published, not uploaded as alerts).
- compliance.yml: REUSE lint over the whole repo (REUSE.toml + LICENSES/,
  no per-file headers) and Conventional-Commit PR titles.
- rust.yml (src-tauri changes + weekly): rustfmt, clippy -D warnings,
  cargo test, and cargo-deny for RustSec advisories, licenses and sources.
- ci.yml `check` gains: coverage thresholds (src/engine, worker),
  check:licenses, check:bundle, and a `wrangler deploy --dry-run`.

Licensing
- THIRD_PARTY_NOTICES.md is now generated from package.json, the installed
  packages and Cargo.toml/Cargo.lock (`npm run generate:third-party`); CI
  fails when it is stale or when anything bundled into the app carries a
  license outside the allowlist. It had drifted to React 18 / Vite 7 /
  Tailwind 3.
- Vite's build.license emits the full text of every bundled package's
  license to /licenses/third-party.md (served publicly, before the gate).

Bundle budget
- scripts/check-bundle-size.ts measures what CLAUDE.md's "500KB" never
  defined: initial load (everything index.html references) <= 280 KB gzip
  (197 KB today) and no JS chunk over 500 KB raw.

Coverage
- @vitest/coverage-v8; thresholds sit just under today's numbers. The
  engine is at 89% lines / 64% functions — not the 100% CLAUDE.md claimed.

Supply chain
- Every third-party action pinned to a commit SHA (Dependabot updates the
  SHA and its version comment); checkout never persists credentials.
- Release workflows: a `verify` job (typecheck, tests, version sync, Tauri
  alignment, tag == package version) gates the build; no dependency caches
  in release jobs; permissions granted per job.
- Reusable Discord workflows receive only the secrets they declare instead
  of `secrets: inherit` (which exposed the Android signing keys to them).
- Rust: cargo-deny found RUSTSEC-2026-0194/0195 (quick-xml DoS, via plist)
  that Dependabot had not raised; plist 1.10 brings quick-xml 0.41.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 19:46:24 +07:00
poli0981andClaude Opus 5.5 f230f036a1 chore(deps): fold the open Dependabot bumps into one update; Tauri 2.12 drops rand
One lockfile instead of nine PRs: every minor/patch the open Dependabot PRs
proposed, plus everything else that moved within range.

npm (`npm update --save`)
- react/react-dom 19.3, vite 8.3, i18next 26.4, react-i18next 17.0.15,
  react-router 7.18.4, eslint 10.11, typescript-eslint 8.71, knip 6.38,
  prettier 3.9.9, @vitejs/plugin-react 6.1, @tauri-apps/* 2.12 / plugins,
  @types/*, @testing-library/react, postcss, autoprefixer, tsx.
- Security: vitest + @vitest/mocker 4.1.11 (path traversal via redirect
  mock), @humanfs/node 0.16.8 (symlinked copy). `npm audit`: 0.
- Majors stay out (TypeScript 7, Vitest 5, lucide-react 1).

Rust (`cargo update -p tauri …`)
- tauri 2.12, tauri-build 2.7, dialog 2.8, fs 2.6, opener 2.7, shell 2.4,
  single-instance 2.5 — matching the npm side minor for minor.
- tauri 2.12 no longer depends on kuchikiki, so `rand` 0.7.3 (the unsound
  custom-logger advisory) leaves Cargo.lock entirely. Only glib 0.18 (gtk-rs
  0.18 Linux stack) remains ignored.

CI and config
- New `npm run check:tauri`: the tauri CLI refuses to build when the npm
  packages and crates differ in major.minor, and CI never runs `tauri build`
  — so a one-sided bump merged green and broke the next release tag. Now CI
  says which side lags.
- dependabot.yml: 3-day cooldown for version updates (security updates are
  exempt), new ui / cloudflare / testing / types groups, rand ignore removed.
- actions/setup-java v5 -> v6 (release-android).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 19:34:44 +07:00
poli0981andClaude Opus 5.5 1fc939b711 fix(web): serve from ytgenerator.stream root and retire the GitHub Pages deploy
The Worker connected to ytgenerator.stream was serving a build made for the
GitHub Pages sub-path: index.html asked for /youtube-generator/assets/*.js, the
SPA fallback answered every one of those with index.html, and the site loaded
blank. Both builds are now served from `/`.

- vite.config.ts: base "/" for web and Tauri alike.
- wrangler.jsonc: the one Cloudflare file in the repo. Assets-only for now
  (dist/, SPA fallback, custom domain declared so `wrangler deploy` never
  detaches it, workers.dev off, build.command runs `npm run build`).
- public/_headers: CSP, nosniff, Referrer-Policy, Permissions-Policy, COOP,
  X-Frame-Options; immutable caching for hashed /assets/*. No HSTS - the
  zone edge already sends it with preload.
- index.html, manifest, robots, sitemap: canonical/OG/JSON-LD on the new
  domain, pt-BR and id added to the locale metadata, Android listed.
- Brand: one SVG source in assets/brand/ now drives the favicon, the PWA
  icons (192/512/maskable), apple-touch-icon, a 1200x630 link-preview card
  and every Tauri desktop/Android/iOS icon. The desktop and Android apps had
  been shipping a flat indigo placeholder square; manifest and index.html
  pointed at four PNGs that did not exist. `npm run generate:brand`
  re-renders the web images; the Android adaptive icon gets a glyph-only
  foreground on the brand colour instead of a tile on a white disc.
- deploy-web.yml and notify-deploy.yml removed, .nojekyll dropped. The last
  Pages deployment stays online untouched until the data-migration page
  replaces it.
- .node-version pins Node 22 for Workers Builds; wrangler, @tauri-apps/cli
  and @resvg/resvg-js are pinned dev dependencies (`npm run cf:dev`,
  `npm run cf:check` for a dry-run deploy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 19:02:57 +07:00
poli0981andClaude Opus 5 0c7fb31165 chore(release): v0.37.0 — dependency modernization
Every major the project had been sitting on, brought current. No user-facing
feature changes; the app should behave identically.

  React 18 → 19 (+ types, @vitejs/plugin-react 6)
  Tailwind 3 → 4
  ESLint 9 → 10 (+ eslint-plugin-react-hooks 5 → 7)
  Zustand 4 → 5
  i18next 23 → 26, react-i18next 15 → 17
  @testing-library/*, typescript-eslint 8.67, Vite/Vitest/tsx/knip patches

**React 19** needed exactly one source change: `useRef<T>(null)` is now typed
`RefObject<T | null>` rather than `RefObject<T>`. The old type quietly claimed a
ref was non-null before its element mounted; ScrollToTopButton now matches,
which makes its existing null check honest rather than defensive.

**Tailwind 4** moves configuration from `tailwind.config.ts` (deleted) into
CSS. The tokens live in an `@theme` block that maps Tailwind's names onto the
existing `:root` / `.light` variables, so the runtime theme toggle still owns
the values and keeps working untouched. `darkMode: "class"` becomes
`@custom-variant dark` — the app toggles a class on <html> rather than
following the OS, so the default prefers-color-scheme variant would be wrong.
Verified in the browser in both themes; a CSS migration fails visually, not at
build time.

**The lint upgrade earned its keep.** `react-hooks/set-state-in-effect` (new in
v7, React Compiler-aware) flagged seven sites. Four were real extra render
passes:

  - use-online-status rewritten to `useSyncExternalStore`. It had been
    re-reading `navigator.onLine` inside an effect to close the gap between
    first render and the listeners attaching — subscribing properly removes the
    gap instead of patching it.
  - ShortcutHelpModal derives its filter from `open` instead of resetting state
    in an effect, so a modal that is closed most of the time stops scheduling
    work on unrelated parent updates.
  - DraftIndicator and use-languages-ready now guard their setters.

Three remain as warnings, deliberately. They genuinely sync state FROM an
external source (i18next bundle readiness, a text mirror of a numeric store
field, a useMemo the compiler cannot preserve) and need a restructure rather
than a guard. Recorded in eslint.config.js with the reason — downgraded, not
silenced, and not a reason to hold back ESLint 10.

**lucide-react deliberately stays at 0.577.0.** 1.x removes every brand icon;
upstream dropped them for trademark reasons. Taking it would mean either a
generic globe beside a Facebook link or re-adding the marks ourselves and
inheriting the exposure lucide just shed. 0.577 already delivered the win —
main bundle 175 kB → 137 kB.

knip now ignores `tailwindcss`: after the migration its only reference is
`@import "tailwindcss"` in CSS, which knip does not follow.

Full gate green — typecheck, typecheck:all, lint, format:check,
validate:locales, knip, check:version, 692 tests, build — plus a browser check
of both themes with the editor and batch pages functional.

0.36.0 is reserved for the two new locales.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 11:43:51 +07:00
poli0981andClaude Opus 5 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>
2026-08-17 10:28:00 +07:00
poli0981andClaude Opus 5 48d5bb035c style: apply Prettier across src, tests and scripts
`prettier --check` failed on 81 files: the repo had a Prettier config and a
`format` script from day one, but nothing ever enforced them, so formatting
drifted file by file. This is that pass, isolated in its own commit so the
CI gate added alongside it lands on an already-clean tree and no future
feature diff has to carry whitespace noise.

Formatting only — no behavioural change. Verified by `npm run test:run`
(621 passing, unchanged) and `npm run typecheck`.

Markdown, `_schema.json` and the workflow YAML are deliberately excluded:
Prettier reflows prose and expands the locale schema's compact arrays by
~1600 lines, which makes both harder to review for zero benefit. The
`format` script is scoped to `{src,tests,scripts}/**/*.{ts,tsx,css}` to
match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 10:27:24 +07:00
poli0981andClaude Opus 4.6 a763f7c78a feat: Phase 1 MVP scaffold — core engine, i18n, UI, CI/CD
Complete Phase 1 implementation of YTDescGen:
- Project setup: Vite 5 + React 18 + TypeScript strict + Tailwind CSS dark theme
- Config layer: 7 video types, 10 genres, 7 platforms, rig/social fields
- i18n: EN/VI/JA with separate UI and template namespaces + validation script
- Core engine: title-builder, description-builder, tag-generator (pure TS, zero React)
- 42 unit tests covering all engine functions
- Zustand stores: editor + settings with localStorage persistence
- UI: 6 primitives, 11 editor components, 4 output components, 3 layout components
- Pages: Editor (form + quick preview) and Output (title/desc/tags + copy)
- CI/CD: GitHub Actions for lint/typecheck/test/build + GitHub Pages deploy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:46:59 +07:00