[PR #2898] [MERGED] Launcher: Download and prepare, from Mojang, for an account that owns the game #4678

Closed
opened 2026-11-03 05:07:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2898
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-mojang-download


📝 Commits (2)

  • 610c2f3 launcher: Download and prepare, from Mojang, for an account that owns the game
  • 43134f4 Merge branch 'feat/launcher-owner-screen' into feat/launcher-mojang-download

📊 Changes

11 files changed (+367 additions, -53 deletions)

View changed files

📝 docs/launcher-commands.md (+2 -1)
📝 docs/microsoft-account.md (+11 -0)
📝 launcher/README.md (+9 -0)
📝 launcher/lang/fr.json (+6 -1)
📝 launcher/lang/ru.json (+6 -1)
📝 launcher/src/backend.rs (+30 -11)
📝 launcher/src/cli.rs (+17 -4)
📝 launcher/src/main.rs (+78 -8)
📝 launcher/src/mojang.rs (+70 -15)
📝 launcher/src/mojang_tests.rs (+137 -11)
📝 launcher/src/servers_page.rs (+1 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #2896, which is stacked on #2892 (the owner gate). Its own diff is the third commit.

What

Brief mc-download-1 (Ludovic, 2026-10-27): a signed-in owner of Minecraft: Java Edition no longer needs another launcher before Horizon. The launcher already had the download itself (mojang.rs, #434). Until now it ran only when no install had the version. This PR makes it something the player can choose, and adds what the download was missing.

  • Play page, Resources row (a version that isn't prepared):
    • Owner (the gate's last answer): "Not prepared. Horizon can download Minecraft 26.3 from Mojang for your account, or use your own install." The buttons are Download and prepare and From my install.
    • No owner: "Not prepared. Sign in with the Microsoft account that owns Minecraft 26.3 first." The button is Sign in, which opens the gate's screen from #2896.
    • Not known yet (the keychain is still being read): the Prepare button as before.
  • horizon-launcher prepare --download, so also the MCP's prepare with download: true.
    • It goes through account::launch first, which asks the services again and needs an owner.
    • Then it downloads into minecraft/ in the launcher's data folder and prepares as before.
    • "From my install" keeps today's path. When no install has the version, it still falls back to the download for an owner.
  • Size and sha1: every file (client jar, libraries, asset index, assets, Java runtime files) must have the size Mojang lists, then the sha1. Before this PR only the sha1 was checked.
  • Progress and Cancel:
    • While downloading, the bar under Play fills with files done out of the total, with a log line every second instead of every five.
    • Cancel stops the download between files ("Download cancelled. Download again to go on where it stopped.").
    • Files already whole are kept, so the next try fetches only the rest.
  • Where files come from is unchanged: Mojang's own URLs, never a mirror, nothing hosted by Horizon. CI, agents and the repo still never download Mojang's files. The tests use a fake server with fake files.
  • Strings in EN, FR and RU. Docs: launcher/README.md, docs/microsoft-account.md ("Downloading the game for an owner"), docs/launcher-commands.md (regenerated).

Tests

In launcher/src/mojang_tests.rs, with a mock of Mojang's servers serving fake files:

  • a_file_of_another_size_than_mojang_lists_is_refused: new.
  • a_cancelled_download_goes_on_where_it_stopped: new. It cancels after the client jar, then a second run fetches only the 6 files left.
  • a_file_that_is_not_the_pinned_one_stops_the_download: the hash mismatch, kept.
  • The layout, rules, sounds and Java runtime tests, updated.

Entitlements yes and no: the gate's tests in #2892 (account::launch, against the mock Microsoft, Xbox and Minecraft services) decide who gets a download.

Screenshots, on the Mac mini:

  • ~/builds/horizon/owner-gate/prepare-sign-in-dark.png and -light.png: the Resources row without an owner.
  • The owner's view comes with the real run.

Still to do: the real run with Ludovic's sign-in, in an isolated home on the Mac mini. It covers download, prepare, an offscreen world, sign out, and a check that the keychain is clean. The orchestrator is arranging it, and the results will be posted on #2892 and here.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 7f760b8eb, 1 min 23 s)

Check Result
Scope ⚠️ 18 files, +1240 −266; 1320 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 365 passed (1 min 0 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (6 s)
launcher tests ✅ 204 passed (15 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

(pr_ready measures against main, so its scope line counts the whole stack.)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2898 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-mojang-download` --- ### 📝 Commits (2) - [`610c2f3`](https://github.com/horizon-rust/horizon/commit/610c2f3c10ff5cdda4408afd17463e8aaad85a1f) launcher: Download and prepare, from Mojang, for an account that owns the game - [`43134f4`](https://github.com/horizon-rust/horizon/commit/43134f4e4127162d407f6c07be10763ae5c1b366) Merge branch 'feat/launcher-owner-screen' into feat/launcher-mojang-download ### 📊 Changes **11 files changed** (+367 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+2 -1) 📝 `docs/microsoft-account.md` (+11 -0) 📝 `launcher/README.md` (+9 -0) 📝 `launcher/lang/fr.json` (+6 -1) 📝 `launcher/lang/ru.json` (+6 -1) 📝 `launcher/src/backend.rs` (+30 -11) 📝 `launcher/src/cli.rs` (+17 -4) 📝 `launcher/src/main.rs` (+78 -8) 📝 `launcher/src/mojang.rs` (+70 -15) 📝 `launcher/src/mojang_tests.rs` (+137 -11) 📝 `launcher/src/servers_page.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #2896, which is stacked on #2892 (the owner gate). Its own diff is the third commit. ## What Brief mc-download-1 (Ludovic, 2026-10-27): a signed-in owner of Minecraft: Java Edition no longer needs another launcher before Horizon. The launcher already had the download itself (`mojang.rs`, #434). Until now it ran only when no install had the version. This PR makes it something the player can choose, and adds what the download was missing. - **Play page, Resources row** (a version that isn't prepared): - **Owner** (the gate's last answer): "Not prepared. Horizon can download Minecraft 26.3 from Mojang for your account, or use your own install." The buttons are **Download and prepare** and **From my install**. - **No owner:** "Not prepared. Sign in with the Microsoft account that owns Minecraft 26.3 first." The button is **Sign in**, which opens the gate's screen from #2896. - Not known yet (the keychain is still being read): the Prepare button as before. - **`horizon-launcher prepare --download`**, so also the MCP's `prepare` with `download: true`. - It goes through `account::launch` first, which asks the services again and needs an owner. - Then it downloads into `minecraft/` in the launcher's data folder and prepares as before. - "From my install" keeps today's path. When no install has the version, it still falls back to the download for an owner. - **Size and sha1:** every file (client jar, libraries, asset index, assets, Java runtime files) must have the size Mojang lists, then the sha1. Before this PR only the sha1 was checked. - **Progress and Cancel:** - While downloading, the bar under Play fills with files done out of the total, with a log line every second instead of every five. - **Cancel** stops the download between files ("Download cancelled. Download again to go on where it stopped."). - Files already whole are kept, so the next try fetches only the rest. - Where files come from is unchanged: Mojang's own URLs, never a mirror, nothing hosted by Horizon. CI, agents and the repo still never download Mojang's files. The tests use a fake server with fake files. - Strings in EN, FR and RU. Docs: launcher/README.md, docs/microsoft-account.md ("Downloading the game for an owner"), docs/launcher-commands.md (regenerated). ## Tests In `launcher/src/mojang_tests.rs`, with a mock of Mojang's servers serving fake files: - `a_file_of_another_size_than_mojang_lists_is_refused`: new. - `a_cancelled_download_goes_on_where_it_stopped`: new. It cancels after the client jar, then a second run fetches only the 6 files left. - `a_file_that_is_not_the_pinned_one_stops_the_download`: the hash mismatch, kept. - The layout, rules, sounds and Java runtime tests, updated. Entitlements yes and no: the gate's tests in #2892 (`account::launch`, against the mock Microsoft, Xbox and Minecraft services) decide who gets a download. Screenshots, on the Mac mini: - `~/builds/horizon/owner-gate/prepare-sign-in-dark.png` and `-light.png`: the Resources row without an owner. - The owner's view comes with the real run. Still to do: the real run with Ludovic's sign-in, in an isolated home on the Mac mini. It covers download, prepare, an offscreen world, sign out, and a check that the keychain is clean. The orchestrator is arranging it, and the results will be posted on #2892 and here. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 7f760b8eb, 1 min 23 s) | Check | Result | | --- | --- | | Scope | ⚠️ 18 files, +1240 −266; 1320 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 365 passed (1 min 0 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (6 s) | | launcher tests | ✅ 204 passed (15 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | (pr_ready measures against main, so its scope line counts the whole stack.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:08 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4678
No description provided.