[PR #7857] Packs: a Modrinth client for resource packs #7865

Open
opened 2026-11-03 07:25:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7857
Author: @itarqos5
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: feat/modrinth-pack-client


📝 Commits (1)

  • cc6742f feat(packs): a Modrinth client for resource packs

📊 Changes

2 files changed (+643 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/lib.rs (+1 -0)
➕ crates/horizon-client-render/src/pack_browser.rs (+642 -0)

📄 Description

🤖 Opened by itarqos5's AI agent (Claude Opus 5), not by itarqos5 personally.

The pieces a screen needs to search Modrinth for resource packs and put one in the packs folder. No UI yet — that is a follow-up, so this can be reviewed on its own.

The launcher already has a browser under launcher/src/browser/, but the launcher is a separate workspace and nothing there is reachable from the game, so this is the small client the game needs. It uses the ureq the game already depends on.

Search and download run on a worker thread and report over a channel; a caller only polls. Filters map to Modrinth facets, grouped so terms inside a group widen the search and separate groups narrow it — asking for 16x and 32x returns both rather than nothing.

A reply is data, not instruction

Risk What stops it
A served name escaping the packs folder separators and .. stripped, always ends .zip
A corrupted or substituted download checked against the SHA-1 the index states
A reply exhausting memory refused above 512 MiB
A pack list seeing a half-written zip written to .partial, then renamed
Clobbering a pack the player already has never overwritten; the new one is numbered

SHA-1 is implemented here rather than adding a dependency for it, and is checked against the published FIPS 180-4 vectors (empty, abc, the 56-byte case, and a multi-block input) so the test does not derive its expectations from the code under test.

Checks

  • cargo test -p horizon-client-render --lib pack_browser — 8 passed, 0 failed on this branch off a clean origin/main
  • Tests cover facet grouping, search parsing with incomplete hits, picking the primary file of the newest version, name sanitising, and not overwriting an existing pack
  • Not a full tools/pr_ready.py run; the vanilla harnesses were not run here. Nothing here touches a vanilla code path.

🤖 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/7857 **Author:** [@itarqos5](https://github.com/itarqos5) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/modrinth-pack-client` --- ### 📝 Commits (1) - [`cc6742f`](https://github.com/horizon-rust/horizon/commit/cc6742f38195a4a8226cd7a21374c4d8d1ecec0d) feat(packs): a Modrinth client for resource packs ### 📊 Changes **2 files changed** (+643 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-render/src/pack_browser.rs` (+642 -0) </details> ### 📄 Description > 🤖 Opened by itarqos5's AI agent (Claude Opus 5), not by itarqos5 personally. The pieces a screen needs to search Modrinth for resource packs and put one in the packs folder. **No UI yet** — that is a follow-up, so this can be reviewed on its own. The launcher already has a browser under `launcher/src/browser/`, but the launcher is a separate workspace and nothing there is reachable from the game, so this is the small client the game needs. It uses the `ureq` the game already depends on. Search and download run on a worker thread and report over a channel; a caller only polls. Filters map to Modrinth facets, grouped so terms inside a group widen the search and separate groups narrow it — asking for 16x **and** 32x returns both rather than nothing. ## A reply is data, not instruction | Risk | What stops it | |---|---| | A served name escaping the packs folder | separators and `..` stripped, always ends `.zip` | | A corrupted or substituted download | checked against the SHA-1 the index states | | A reply exhausting memory | refused above 512 MiB | | A pack list seeing a half-written zip | written to `.partial`, then renamed | | Clobbering a pack the player already has | never overwritten; the new one is numbered | SHA-1 is implemented here rather than adding a dependency for it, and is checked against the published **FIPS 180-4** vectors (empty, `abc`, the 56-byte case, and a multi-block input) so the test does not derive its expectations from the code under test. ## Checks - `cargo test -p horizon-client-render --lib pack_browser` — **8 passed, 0 failed** on this branch off a clean `origin/main` - Tests cover facet grouping, search parsing with incomplete hits, picking the primary file of the newest version, name sanitising, and not overwriting an existing pack - Not a full `tools/pr_ready.py` run; the vanilla harnesses were not run here. Nothing here touches a vanilla code path. 🤖 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>
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#7865
No description provided.