Files
poli0981andClaude Opus 4.7 91afd4ecf9 Add webapp Phase 8: Tauri 2 desktop wrapper scaffold
The same React build can now ship as a native Win/macOS/Linux app via
Tauri 2. Web users still get the GitHub Pages SPA; desktop users get
a ~10 MB installer that can scrape itch.io directly without CORS.

src-tauri/:
- Cargo.toml: tauri 2 + tauri-plugin-http 2, edition 2021. Release
  profile uses panic=abort, lto=true, opt-level='s', strip — minimizes
  the bundled binary.
- tauri.conf.json: window 1280x800 (min 900x600), bundle targets all
  platforms, identifier com.poli0981.free-games-itchio-webapp.
- src/main.rs + src/lib.rs: minimal builder + one Tauri command
  (runtime_info) so the frontend can confirm desktop mode.
- capabilities/default.json: scopes the http plugin to itch.io,
  img.itch.zone, api.github.com, raw.githubusercontent.com.

Frontend plumbing:
- lib/runtime.ts: isTauri() probes window.__TAURI_INTERNALS__ to
  branch features at runtime. getRuntimeInfo() lazy-imports
  @tauri-apps/api/core only on desktop, so web bundles aren't bloated.
- lib/tauri-scrape.ts: tauriScrapePreview(url) uses the http plugin to
  fetch an itch.io page and pulls og:title / og:description / og:image
  out of the HTML. Full 23-field extraction stays in scripts/scraper.py
  and runs in CI; porting to Rust is tracked as Phase 8b in TAURI.md.
- Sidebar gains a small "Desktop mode (Tauri)" badge above the theme
  toggle when running native.
- vite.config.ts: when TAURI_ENV_PLATFORM is set, build to ./dist (not
  ../docs/app), drop sourcemaps, and target ES2022 — the bundled
  WebView2/WKWebView/WebKitGTK all support modern JS.
- package.json scripts: tauri / tauri:dev / tauri:build.

CI:
- .github/workflows/release_desktop.yml: builds for macOS (universal),
  Ubuntu 22.04, and Windows on tag v* via tauri-apps/tauri-action,
  caches cargo with Swatinem/rust-cache, installs Linux WebKit deps,
  and uploads the bundle to a draft GitHub Release.

Docs:
- webapp/TAURI.md: prereqs (rustup + platform deps), how to dev, how
  to build installers, how to add new Rust commands, roadmap to a
  full Rust scrape (Phase 8b).

.gitignore picks up the Cargo target/, generated gen/, and Cargo.lock
under src-tauri.

Note: Local `npm run tauri:dev` requires a Rust toolchain
(https://rustup.rs); the GitHub Actions workflow installs it
automatically. The web build still works without Rust installed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 09:00:37 +07:00

4 lines
39 B
Rust

fn main() {
tauri_build::build()
}