# ShaCraft Launcher — agent context ## Purpose and scope Cross-platform desktop launcher for the ShaCraft Minecraft network. It is a Tauri 2 application: React/Vite is the UI and Rust owns all filesystem, network and process-adjacent work. The current production profile is **Aeronautics** (Minecraft 1.21.1, NeoForge 21.1.248, Java 21). This repository owns the launcher only. The server-side API and published payload are in `/root/shacraft` on the ShaCraft host; see `docs/launcher-architecture.md` before changing an integration boundary. ## Non-negotiable boundaries - Launcher-managed payload is limited to ShaCraft-owned configuration and approved modpack files. Never make arbitrary URLs, shell commands, or local paths controllable by a remote manifest. - Do not add private keys, OAuth secrets, `.env` values, player data, or built artifacts to Git. ## Trust model - The only supported remote profile manifest endpoint is `https://shacraft.ru/api/launcher/v2/profiles/aeronautics/signed-manifest`. The read-only Aeronautics player-count endpoint `https://shacraft.ru/api/online/aoc` is also hardcoded in `remote.rs`; it is display-only and is never allowed to influence downloads or launching. - The response is an Ed25519 envelope. `src-tauri/src/remote.rs` verifies its embedded public key and `keyId` **before** parsing the payload. - `src-tauri/src/manifest.rs` then validates paths, SHA-256, sizes, HTTPS and allowed ShaCraft hosts. Do not weaken this whitelist. - `src-tauri/src/profile.rs` downloads to a temporary sibling file, verifies size + SHA-256, and atomically replaces only launcher-managed files. - This ShaCraft manifest is the **only** source of truth for which Minecraft version / NeoForge version / Java major a profile needs (`Manifest.minecraft`) and for mod/config files. It never supplies a URL for the game itself — see `docs/game-trust-boundary.md` for the four independent, hardcoded-host trust domains (Mojang, NeoForge, Microsoft, Adoptium) that install and run the actual game. Do not let manifest data control a URL in any of those domains. - ShaCraft accounts: `src-tauri/src/shacraft_account.rs` talks only to the hardcoded `https://shacraft.ru` origin. Passwords are never persisted. The revocable session token is stored locally with mode 600 on Unix. At launch, the nickname is fetched from the verified `aoc` account link; the legacy nickname in `settings.json` is ignored as an identity source. Server-side whitelist enforcement and LoginSystem remain the final access-control boundary, including for old launcher versions. ## Layout - `src/main.tsx` — UI state and Tauri command calls; do not put privileged operations in the web layer. - `src-tauri/src/` — native commands and security-sensitive logic. - `download.rs` — shared verified-download helper (temp file, hash, atomic rename, progress callback); `manifest.rs`/`profile.rs` (ShaCraft mods) and `mojang.rs`/`neoforge.rs`/`runtime.rs` (the game itself) all build on this rather than each rolling their own. - `mojang.rs` — vanilla Minecraft trust boundary + the generic `inheritsFrom` version-JSON merge (shared with NeoForge's profile). - `neoforge.rs` — runs NeoForge's official installer headlessly. - `runtime.rs` — Java 21 auto-provisioning via Eclipse Adoptium. - `msa.rs` — Microsoft/Xbox/Minecraft Services login; see `MSA_CLIENT_ID`'s doc comment before touching login — it is currently a placeholder pending ShaCraft's own Azure AD app registration and Minecraft-API approval. - `shacraft_account.rs` — local ShaCraft login/registration, session and verified nickname-link API. - `launch.rs` — builds and spawns the actual `java` process. - `src-tauri/src/settings.rs` — durable local preferences; maintain backward compatibility with already-written JSON. - `docs/manifest-v1.md` — signed manifest envelope and payload contract (mods/config only). - `docs/game-trust-boundary.md` — the Mojang/NeoForge/Microsoft/Adoptium trust domains used to install and run the game itself. - `.github/workflows/build.yml` — manual cross-platform build matrix. ## Verification Run from repository root: ```bash npm run build (cd src-tauri && /home/emil/.cargo/bin/cargo test) npm run tauri:dev ``` `tauri:dev` is for local desktop testing. A successful web build alone does not prove Tauri commands work. ## Working conventions - Keep UI copy in Russian; code, identifiers and errors may remain English. - Prefer a small vertical slice with tests over unused abstractions. - Existing working-tree changes belong to the user unless this task created them. Inspect `git status` before staging. - Update this file and `docs/launcher-architecture.md` whenever the trust model, endpoint contract, storage layout, or release workflow changes.