launcher: Download and prepare, from Mojang, for an account that owns the game

With the owner gate in place, a signed-in owner no longer needs another
launcher first (brief mc-download-1, Ludovic 2026-10-27).

- The Play page's Resources row offers an owner "Download and prepare"
  and "From my install"; without an owner it asks to sign in first.
- `horizon-launcher prepare --download` does the same.
- Every file from Mojang must have the size and sha1 Mojang lists.
- The download shows its progress and has Cancel; files already whole
  are kept, so the next try goes on where it stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-27 18:33:53 +01:00
parent 7afb41a128
commit 610c2f3c10
11 changed files with 367 additions and 53 deletions
+17 -4
View File
@@ -548,12 +548,16 @@ enum Cmd {
Install { tag: String },
/// Remove an installed version
Remove { tag: String },
/// Prepare a version's resources from your own Minecraft install
/// Prepare a version's resources from your own Minecraft install, or from Mojang
Prepare {
/// The game folder of the official launcher, Prism Launcher, MultiMC, the Modrinth App,
/// ATLauncher or GDLauncher (default: the launcher's, then every launcher's default)
#[arg(long)]
#[arg(long, conflicts_with = "download")]
minecraft: Option<PathBuf>,
/// Download Minecraft from Mojang for the signed-in account that owns it, instead of
/// using an install
#[arg(long)]
download: bool,
/// The installed version (default: the selected one)
#[arg(long)]
version: Option<String>,
@@ -974,11 +978,20 @@ fn execute(command: Cmd, as_json: bool) -> Result<(), String> {
backend::remove_version(&tag)?;
println!("Removed {tag}.");
}
Cmd::Prepare { minecraft, version } => {
Cmd::Prepare {
minecraft,
download,
version,
} => {
let tag = backend::resolve_version(version.as_deref())?;
let minecraft = backend::minecraft_dir(minecraft)?;
let from = if download {
backend::MinecraftFrom::Mojang
} else {
backend::MinecraftFrom::Install
};
let (preparer, minecraft) =
backend::preparer(&tag, &minecraft, &|line| eprintln!("{line}"))?;
backend::preparer(&tag, &minecraft, from, &|line| eprintln!("{line}"))?;
backend::sounds(&tag, &minecraft, &|line| println!("{line}"));
match preparer {
backend::Preparer::Process(cmd) => attached(cmd)?,