17 Commits
Author SHA1 Message Date
poli0981andClaude Fable 5.2 0e0e442de5 chore: maintenance mode, Qodana analysis; 4.6.1 (#188) [skip-discuss]
The project moves to maintenance mode (stable, feature-complete): docs, templates and badges (EN + VI). Qodana analysis in CI for the TypeScript / JavaScript, Python and Rust projects, with the findings of its first reports fixed. Version 4.6.1.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 21:44:32 +07:00
poli0981andClaude Opus 5.5 047d918d43 feat: accessibility statement, keyboard/screen-reader/chart/contrast fixes; 4.6.0 (#183) [skip-discuss]
Accessibility pass for the website and the apps (WCAG 2.2 AA target) and the accessibility statement: root ACCESSIBILITY.md + docs/i18n/vi/ACCESSIBILITY.md, the accessibility issue form, a default PR template; focus management, the '/' shortcut switch, chart names and data tables, contrast tokens with a CI check, Windows contrast themes; a docs sync of verified mismatches; version 4.6.0 with the two deps sweeps since 4.5.0 (#176, #182).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 14:16:50 +07:00
poli0981andClaude Opus 5.5 45f64e6c39 docs(rate-limits): Worker binding counts per machine; test over one connection (#168)
Measured on production after the 4.5.0 deploy: with a new connection per
request, 1,000 requests in 53 s got no 429 from RL_SITE (120/60 s); over
one keep-alive connection, 429 after ~93. The ratelimits binding counts per
machine of a data centre and syncs late, so the zone's WAF rule is the
limit that holds against floods. Verified once the owner set the rule
(300/10 s): 800 requests in 4.9 s gave 111 x 200, 201 x Worker 429 and
488 x WAF 1015, with the site answering again 10 s later.

Runbook test commands, code comments, CLAUDE.md gotcha 43, the 4.5.0
changelog entry.

[skip-discuss]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:17:42 +07:00
poli0981andClaude Opus 5.5 7920011c70 feat(worker): rate limits for the whole site (4.5.0) (#167)
Every request that runs the Worker is counted per client (IPv4, or IPv6
/64): RL_SITE 120/min (app pages, public /api, the old apps' /data JSON,
misses), RL_IMG 600/min (covers), RL_ADMIN 300/min (/admin + /api/admin);
RL_SUGGEST 5 and RL_GATE 20 stay on top for their POSTs. Verified bots are
not counted. Over a limit: 429 + Retry-After 60 (JSON for the API, covers,
files and /data with CORS; a script-less EN/VI page for app pages). Fails
open.

Every rate-limit namespace moves to 8801-8806 (staging 8901-8906):
namespace ids are account-wide, and other Workers on the account use
1001-1006, so RL_SUGGEST / RL_GATE shared their counters.

docs/operations.md section 1 step 15: the zone's WAF rate-limiting rule as
the first layer (Free plan: one rule, IP, 10 s; 300 requests / 10 s).

[skip-discuss]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:02:49 +07:00
poli0981andClaude Opus 5.5 999d0887ee Fix the SonarQube Cloud findings; release 4.4.2 (#155)
The first SonarQube Cloud scan reported 57 issues. 45 are fixed in code, the 11 on the saved itch.io test pages leave the scan via .sonarcloud.properties, and css:S8776 (Tailwind's @utility nesting) is a false positive to mark on SonarQube Cloud.

Worker: trailing slashes and the gate cookie's padding are trimmed by trimEnd() instead of /\/+$/ (quadratic on the public 404 path); the feed and collection parsers lose their backtracking regexes; compareCodeUnits keeps the code-unit sorts (the rule's localeCompare is locale-dependent); Number.*, DEFAULT_SIZES, crypto.randomUUID; i18n-edit.mjs reads stdin. Pipeline: the NSFW notices are one selector list, either class (the rule's ".a.b" would need both), each tested; plain if-guards; update_info.main returns None; no plain-http adapter; [[ ]] in cf_build_status.sh.

Supply chain: requirements*.txt are hash-locked pip-tools compiles of requirements*.in (on Python 3.14, which Dependabot reads from the header), installed with --require-hashes --only-binary :all: in block scalars; npm ci --ignore-scripts in CI and the release builds (verified by manual release runs on all platforms); npm run cf:check.

Release 4.4.2: also ships the toolchain upgrade (#149, #154) and Dependabot #141-#148, #150, #152, #153. CLAUDE.md gotchas 40 and 41.

[skip-discuss]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:16:12 +07:00
poli0981andClaude Opus 5.5 f199e2ea17 Retire the browser extension's ingest API; release 4.4.1 (#138)
The browser extension (poli0981/itch-f2p-extension) and the Telegram bot (poli0981/telegram-scraper-bot) are archived. Removed: POST /api/ingest (ingest.ts, requireService, the idempotency store, RL_INGEST, ACCESS_AUD_INGEST; it never received a game), the admin's "Browser extension" auto-approve source and "Extension" queue label, and the About page's Telegram numeric-ID note. No D1 migration: the idempotency table and the 'ext' CHECK stay.

Policies (Privacy, ToS, EULA + installer RTF, Disclaimer, Security; EN + VI) drop the extension / ingest wording; Last updated 2026-10-16, LEGAL_VERSION unchanged. Docs, CLAUDE.md and pipeline comments updated.

Release 4.4.1 (also ships #131, #135, #136, #137).

[skip-discuss]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:56:46 +07:00
poli0981andClaude Opus 5.5 f2a5135993 v4.4.0: admin automation, bulk remove/edit, theme icon, smooth chart tabs (#133)
Admin: add games from any list or itch.io collection (Check first, batches of 200, per-game ingest tracking from scripts/state/ingest_outcomes.json), followed collections and auto-approve run by the cron in one [auto] commit, bulk remove/edit up to 100 games in one commit, New games, Activity and Settings pages. D1 migration 0002 (applied to production before this merge). Policies (ToS, Privacy, Disclaimer, EN + VI) cover approval by the maintainer's rules; LEGAL_VERSION 2026-10-13.

Web: the theme button shows the theme in use, no dark-mode flash (pre-paint script, hash in three CSPs), Charts tabs stay mounted (no rebuilt charts or replayed animations), 300 ms entrances, scrollbar gutter on mouse devices.

Release 4.4.0 (changelog also covers #130).

[skip-discuss]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:08:33 +07:00
poli0981andClaude Opus 5.5 a3bfe04b40 Compact catalog packs, binary cache, themed scrollbars; bump to 4.2.0 (#103) [skip-discuss]
- Catalog packs: the build emits /data/pack/manifest-v1.json plus
  content-hashed deflate-raw packs (columns + dictionaries); the site and
  the apps read them (about 264 KB on a first visit instead of about 520 KB
  of JSON). Descriptions live in their own packs and load on demand (a game
  page: its chunk; a search: all of them).
- The IndexedDB cache is stored as compressed bytes by a small binary
  persister (replaces @tanstack/query-async-storage-persister); fflate is
  the lazy fallback where the browser has no Compression Streams.
- The readable /data/*.json goes only to apps 4.0-4.1.1 (Tauri Origin);
  everyone else gets a 410 with links to the repository
  (worker/legacy-data.ts, five positive run_worker_first entries).
- /img: exact width strings only, fallback originals and missing images
  kept at the edge for a day, failed background puts are logged.
- Themed scrollbars and a "Hide scrollbars" setting (Settings and the
  display menu); chart cards no longer block their list scrollbars.
- Policies (LEGAL_VERSION 2026-10-03): data reuse goes through the
  repository. Docs, changelog and version 4.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:19:42 +07:00
poli0981andClaude Opus 5.5 2c2d990f33 feat(worker): Turnstile verification gate for the web app
Until a visitor passes a Cloudflare Turnstile check, app pages ("/" is
now Worker-first too) answer with a self-contained verification page and
/img covers with 403, so a browser loads nothing of the site before the
check. Passing sets an HttpOnly, host-only cookie (HMAC of its issue
time) good for BOT_GATE_TTL_HOURS (48). The page then reloads into the
link that was asked for, and the legal gate follows as before.

- /assets, /data (desktop/Android apps, CC BY reuse), robots, sitemap,
  og image, /api/* and /admin* stay ungated.
- Verified bots pass with the token a zone Transform Rule adds
  (x-fig-known-bot); clients that only claim to be a search crawler get
  a 503, never the noindex page.
- Fails open: it needs BOT_GATE="on", the Turnstile keys, GATE_SECRET
  and GATE_BOT_TOKEN; deleting GATE_SECRET switches it off at once.
- POST /api/verify: same-origin, RL_GATE (IPv4 / IPv6 /64), siteverify
  with action "gate". GET reports the pass for the page and the SPA.
- turnstile.ts: siteverify shared with Suggest, which now also checks
  the hostname and action (a token from one page can't be spent on the
  other) and answers 503 when Turnstile is unreachable.
- SPA: a tab whose pass ran out re-checks when shown again or when a
  cover fails, and reloads into the verification page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 17:56:33 +07:00
poli0981andClaude Opus 5 066f368b53 fix(worker): accept the GitHub App key as downloaded (PKCS#1)
Approving from the queue failed with 500 "internal_error"; the Worker log
said: TypeError: "pkcs8" must be PKCS#8 formatted string. GitHub downloads
App keys as PKCS#1, which WebCrypto cannot import.

- github.ts wraps a PKCS#1 PEM into PKCS#8 itself (and turns two-character
  "
" escapes into newlines), so the downloaded key works unchanged.
- GitHub failures throw GitHubError and the admin API answers 502
  github_error with the reason, instead of a bare internal error.
- Admin CSP allows the Cloudflare beacon the zone injects into every HTML
  response; dropped browsing-topics from Permissions-Policy (Chrome no
  longer knows the feature and logs an error on every page).
- Docs: the key needs no openssl conversion any more.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 15:38:05 +07:00
poli0981andClaude Opus 5 e4a5ee532d fix(worker): keep the dashboard settings in wrangler.jsonc; Access fixes
- wrangler.jsonc vars now hold the production values set in the dashboard
  (GitHub App ids, Access team domain and AUD tags, Turnstile site key).
  A deploy replaces plain-text variables with the file's values, so the
  next data commit would have blanked them.
- access.ts: ignore a trailing slash in ACCESS_TEAM_DOMAIN (the issuer is
  the bare origin; the dashboard value had one).
- /admin redirects to /admin/ (the path the Access application covers), so
  the visitor gets the login page instead of a 403.
- Runbook: values must be changed in the file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 22:18:37 +07:00
poli0981andClaude Opus 5 41a8f8461f fix: Phase 4 review findings (admin, ingest, suggest)
Worker
- The local DEV_ADMIN_EMAIL bypass keeps the same-origin check for
  writes, and JSON bodies must be exactly application/json (a cross-site
  `text/plain; application/json` POST no longer gets through without a
  preflight).
- Request bodies are capped while they stream (a chunked upload without
  Content-Length is never buffered past 4 KB / 64 KB).
- count_history.json is rewritten when today's row already exists
  (upsertCountHistory no longer mutates the rows it was given).
- A game that entered the catalog through the queue, was removed and turns
  up again is reviewed again (flagged previously removed) instead of being
  blocked as "already pending" for good.
- Restoring / approving a removed game no longer deletes its public
  removal record up front: the Worker allow-lists it in
  scripts/state/unblocked.json, update_info.py scrapes it despite the
  deleted log, and apply_patch.py drops the log entry only when the game is
  really re-added (a still-paid or dead game keeps its record).

Admin app
- The editor compares against what the repository holds (published data
  or what was saved in this session), so saved changes can be reverted and
  are never dropped silently.
- An Access session that expires mid-session shows a sign-in banner from
  any request, without losing what is on the page.
- Restore refreshes the queue; knip now checks the admin entry.

Suggest page
- The form doesn't let the browser's URL check block links without
  https:// (the page and the server accept them).
- A failed config request shows an error with Retry instead of a
  permanently disabled form or a false "closed" message.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:55:02 +07:00
poli0981andClaude Opus 5 6f8b9ed490 feat(web): 18+ games hidden by default, /removed, version 4.0.0
- Games marked nsfw=Yes are left out of the table, dashboard and charts
  unless the visitor opts in (Settings -> Content, after confirming they
  are 18+; stored only in this browser). Their detail pages show a notice
  instead. The admin app still sees everything.
- /deleted is now /removed (301 from the Worker, redirect in the SPA,
  sitemap and canonical updated); <html lang> follows the language.
- Legal links: the gate lists only the documents being accepted (ToS,
  Privacy, Disclaimer, and the EULA inside the apps) and asks to confirm
  the visitor is 16+; new "Licenses & notice", "Data license" and
  "Content removal" links; the retired Telegram bot link is gone.
  LEGAL_VERSION 2026-09-18, so everyone is asked once more.
- Version 4.0.0 in about.ts, package.json (+ "license": "MIT"),
  tauri.conf.json (+ bundle copyright), Cargo.toml / Cargo.lock.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:55:02 +07:00
poli0981andClaude Opus 5 cbe3e389ea feat(web): admin app and public Suggest page (v4 Phase 4)
- webapp/admin/: a second Vite entry (/admin/, HashRouter), served only
  by the Worker after the Access check, with its own CSP. Review queue by
  status (approve, approve with override for previously removed games,
  reject), paste-to-add URLs, and a catalog editor for the three
  maintainer fields, removal with a public reason, and restore of removed
  games. Uses the published /data for search; every write is applied to
  the latest repository state by the Worker. An expired Access session
  surfaces as "sign in again" instead of a broken request.
- /suggest (web only; the desktop/Android apps link to the website):
  itch.io link + optional note (<= 500 characters, deleted after 180
  days), Cloudflare Turnstile loaded on demand, EN + VI strings.
- Local development: DEV_ADMIN_EMAIL in .dev.vars lets `wrangler dev` on
  localhost into the admin without Access; it is ignored on any other host.

Checked in wrangler dev with a local D1: queue listing, reject, approve
answering "GitHub App not configured", catalog search/editor, and a
Suggest submission (Turnstile test keys) landing in the queue; no CSP
violations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:55:01 +07:00
poli0981andClaude Opus 5 8f121a8e9c feat(worker): review queue, admin API, ingest and suggest endpoints (v4 Phase 4)
Adds the server side of the admin and the automatic game discovery. The
catalog stays JSON in this repo; the Worker writes it as a GitHub App
(GraphQL createCommitOnBranch with expectedHeadOid: verified commits,
retried on a race) and keeps only the review queue in D1.

- worker/admin.ts: /api/admin/* (queue list, approve/reject, add, edit the
  three maintainer fields, remove with reason + R2 cover cleanup, restore)
  and the /admin shell with its own CSP. Every request re-verifies the
  Cloudflare Access JWT (aud + maintainer email + same-origin writes).
  Approving commits to scripts/temp_link.json, which starts update.yml.
  The maintainer's email goes to the D1 audit log only, never a commit.
- worker/ingest.ts: POST /api/ingest for the browser extension (Access
  service token, per-client rate limit, Idempotency-Key replay, <= 150
  items / 64 KB), replacing its PAT commits.
- worker/suggest.ts: public POST /api/suggest (same-origin, per-IP rate
  limit, Turnstile siteverify, canonical itch.io URL) into the queue.
- worker/discover.ts + scheduled(): every 4 h, one itch.io RSS feed
  (round-robin, 6 h back-off on 429) into the queue, then reconcile
  (queued -> ingested / failed) and retention (idempotency 7 d, form
  notes 180 d).
- worker/queue.ts: URL classification (catalog, pending, deleted,
  blocklist) and the D1 store; worker/repo.ts builds each admin commit
  from the files at the head of main, byte-compatible with the Python
  pipeline (golden fixtures).
- wrangler.jsonc: D1 (bound by name; migrations applied by hand), rate
  limits, cron, non-secret settings as vars (empty until setup: features
  answer 503 until configured), staging env without the cron.
  `npm run cf:types` ignores .dev.vars so the committed types are stable.
- Tests: 159 passing; the SQL runs against a real local D1 (workerd via
  wrangler's platform proxy).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:55:01 +07:00
poli0981andClaude Opus 5 ce177d8f27 fix(web): review findings on the Worker platform (v4 Phase 2)
- Missing files no longer get the app shell: `not_found_handling: "none"`
  and worker/spa.ts answer /assets/*, /data/* and file-like misses with a
  real 404 (no-store). A stale hashed chunk used to get index.html with
  the year-long immutable cache of /assets/*. Routes get the shell with
  200; unknown paths and unknown game slugs get it with 404.
- Recharts is off the first load again (~314 -> ~195 KB gzip): drop the
  vendor-charts group, which captured React and clsx, and give
  vendor-react the top priority.
- Web build target restored (Safari/iOS 15.4): Vite 8's default shipped
  Radix class static blocks unlowered, a blank page on iOS 15.
- The allow-list cache shares only loaded values, never an in-flight
  promise: a cancelled first /img request hung every later one.
- /img answers upstream resets and R2 errors with a 502 instead of an
  uncaught exception, and releases unused upstream bodies.
- Per-route canonical + robots (useSeoHead) instead of a static root
  canonical and og:url on every page.
- Legacy hash redirect: crafted hashes (#//host, #/\host) go home
  instead of throwing before React mounts.
- Chunk-reload guard is time-windowed and storage-safe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:55:01 +07:00
poli0981andClaude Opus 5 1910d61d08 feat(web)!: Cloudflare Worker platform, read-only app (v4 Phase 2)
BREAKING: the public web app has no sign-in anymore and uses real paths
(BrowserRouter); /add and /workflows are gone (admin comes in Phase 4).

Platform
- wrangler.jsonc: Worker (worker/index.ts) + static assets with SPA
  fallback; only /img/* and /api/* run the Worker. R2 binding THUMBS,
  `staging` env for the v4 pre-release Worker. worker-configuration.d.ts
  from `wrangler types` (checked in CI with --check).
- vite-plugins/catalog-data.ts bundles data_game + deleted log into
  dist/data (build fails on bad JSON / index mismatch), emits urls.json
  (thumbnail allow-list) and a real-path sitemap; version.json carries
  the build stamp so data-only rebuilds keep identical JS.
- Data is read same-origin from /data (Tauri: https://freeitchgames.win/data,
  CORS *); chunks load with allSettled.
- worker/img.ts: /img/<160|640>/<itch path> serves a WebP rendered once
  per image+width by Image Transformations and stored in R2 (edge cache
  → R2 → transform); catalog allow-list, fixed upstream host, hotlink
  block, streamed original on transform failure, 403/404 upstream → 404.
  15 vitest cases.
- Enforced CSP (same-origin + Web Analytics/Turnstile), cache headers for
  /assets, /data, og/icons; security.txt; robots disallows /api, /admin.

App
- Remove PAT/GPG sign-in, bulk edit/delete, undo, workflow dispatch,
  Octokit and OpenPGP (and ~220 write-path i18n keys); Settings keeps
  language/theme/density/notifications only.
- react-router 8 (unified package), React 19.3, TanStack/Recharts/etc.
  minors, Vite 8 rolldown codeSplitting groups; legacy #/ links are
  rewritten to paths; old PAT/GPG localStorage keys are cleared; reload
  once on vite:preloadError after a deploy.
- GameThumb uses the /img proxy (referrerPolicy no-referrer, N/A-safe).

Tauri
- Real CSP, drop the unused http plugin + capability, read-only
  descriptions, rust-version 1.88, drop the time pin, commit Cargo.lock.

Also: remove the GitHub Pages redirect workflow/stub (deployed by v4
Phase 0); add scripts/i18n-edit.mjs (TS-parser based key maintenance for
en.ts/vi.ts).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:54:49 +07:00