Launcher: Horizon's registry as a mod browser source

A browser source for Horizon's own registry (docs/api/mod-index.md): it reads index.json
(HORIZON_MOD_INDEX for a test registry, cached in the game folder for when the registry can't
be reached), searches it by kind and words, lists versions with the SHA-256 the index gives,
and blocks the versions it says were taken down. Downloads accept the registry's release host
and check SHA-256; file:// files only from a local index.

Installing, the takedown check before play and the CLI come next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 22:47:37 +02:00
parent bffb68b0c5
commit 7e513d2d5c
11 changed files with 423 additions and 18 deletions
+3 -1
View File
@@ -18,6 +18,7 @@ fn version(id: &str, games: &[&str], loaders: &[&str]) -> Version {
name: format!("{id}.zip"),
size: 3,
sha512: Some("ab".into()),
sha256: None,
sha1: None,
primary: true,
}],
@@ -305,6 +306,7 @@ fn file_for(body: &[u8], sha512: bool) -> FileRef {
name: "pack.zip".into(),
size: body.len() as u64,
sha512: sha512.then(|| hex(&sha2::Sha512::digest(body))),
sha256: None,
sha1: (!sha512).then(|| hex(&sha1::Sha1::digest(body))),
primary: true,
}
@@ -383,6 +385,6 @@ fn live_modrinth_search_pick_and_download() {
#[test]
fn curseforge_is_coming_soon_and_never_searched() {
let ids: Vec<SourceId> = sources().iter().map(|s| s.id()).collect();
assert_eq!(ids, [SourceId::Modrinth]);
assert_eq!(ids, [SourceId::Modrinth, SourceId::Horizon]);
assert!(source(SourceId::CurseForge).is_none());
}