Launcher: install from Horizon's registry, enable and disable, takedowns

Mods install into horizon-mods/<id>.hmod (turned on) and resource packs into
resourcepacks/, each downloaded to mod-browser/downloads/ and checked by
horizon_mods::index::check_file (size, SHA-256, signature, manifest) before it
is moved into place. Files the index takes down are turned off when the index
is read or the game starts, and can't be installed or turned back on. CLI (and
so MCP): --source horizon, mods enable|disable, and search shows whether a
project is signed and what a mod may do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 22:47:51 +02:00
parent 7e513d2d5c
commit b49fd602df
8 changed files with 393 additions and 9 deletions
+10
View File
@@ -110,6 +110,16 @@ pub fn check_project(
Ok((version, check))
}
/// Whether mod `id` is on in `horizon-mods.txt`.
pub fn is_enabled(home: &Path, id: &str) -> bool {
let key = format!("mod.{id}");
fs::read_to_string(home.join(MODS_LIST))
.unwrap_or_default()
.lines()
.filter_map(|l| l.split_once(':'))
.any(|(k, v)| k.trim() == key && v.trim() == "true")
}
/// Turns mod `id` on (or off) in `horizon-mods.txt`, keeping the other lines.
pub fn set_enabled(home: &Path, id: &str, on: bool) -> Result<(), String> {
let path = home.join(MODS_LIST);