Commit Graph
18 Commits
Author SHA1 Message Date
objz 29ad70fa16 chore: add SPDX copyright headers 2026-08-24 19:13:43 +02:00
objz c6205a337c refactor: reorganize source and tests 2026-07-27 11:28:57 +02:00
objz 9b17ec96c5 test(net): consolidate live API smoke tests 2026-07-27 00:38:03 +02:00
objz fbf8142ea0 feat(content): add managed content metadata layout 2026-07-25 12:14:30 +02:00
objz 09bc8f26fb chore: improve rmcl diagnostic logging 2026-06-16 10:22:51 +02:00
objz 5f43128a80 added: tests for patches helpers, forge installer detection, url_encode, profile fetchers
Closes the seven remaining tractable coverage gaps the final review
flagged. All tests-only or tiny *_from variants matching the existing
pattern. 18 new tests.

- src/instance/launch/patches.rs: seven inline tests for the lwjgl3ify
  patch helpers that were entirely untested before. strip_replaced_libs
  has happy + no-op cases. parse_add_opens covers the basic Add-Opens
  extraction, the MANIFEST.MF continuation-line case (the tricky one:
  jar manifests wrap lines with a trailing space + leading-space marker
  that gets stripped on join), missing manifest, and missing file.
  add_lwjgl3 verifies that only jars that actually exist in lib_dir
  end up on the classpath.

- src/net/forge.rs: three inline tests for has_legacy_install_profile.
  Builds synthetic forge installer zips in a tempdir with and without
  the versionInfo key in install_profile.json; covers the missing-jar
  branch with a path that doesn't exist.

- src/net/modrinth.rs: five-case rstest for url_encode covering the
  unreserved set, space, RFC 3986 reserved characters, multi-byte UTF-8
  (the encoder operates per-byte so emoji exercises the multi-byte
  path), and empty input.

- src/net/fabric.rs / src/net/quilt.rs: added fetch_*_profile_from and
  fetch_*_profile_with_raw_from variants mirroring the existing pattern.
  Existing fetch_*_profile and *_with_raw delegate to them with the
  upstream constants.

- tests/net_loaders.rs: two new wiremock tests (fabric_fetch_profile
  parses libraries, quilt_fetch_profile parses libraries) using the
  new _from variants.

- src/tui/widgets/popups/import_modpack/render.rs: extra snapshot for
  the Confirm step when loader_version is None (vanilla pack or old
  mmc pack). The previous Confirm snapshot covered Some(_) only.

Production touches stay minimal: the four new pub fn delegators in
fabric.rs and quilt.rs, all behaviour-preserving.
2026-05-27 18:19:26 +02:00
objz 0eb47fd7b4 added: *_from variants in net::{forge,fabric,quilt,neoforge} + assets
Same pattern as fetch_version_manifest_from from the earlier batch:
each fetcher gets a sibling that takes the URL as a parameter; the
existing function delegates to it with the upstream constant.
Production callers are unchanged.

- src/net/forge.rs: fetch_forge_versions_from(client, promotions_url,
  game_version) and fetch_forge_game_versions_from(client,
  promotions_url).
- src/net/fabric.rs: fetch_fabric_game_versions_from(client, base) and
  fetch_fabric_versions_from(client, base, game_version). The fabric
  API is hierarchical so the helpers take the meta base URL and append
  the rest internally, matching the existing layout.
- src/net/quilt.rs: same pair as fabric.
- src/net/neoforge.rs: fetch_neoforge_versions_from(client, api_url,
  game_version).
- src/net/mojang.rs: download_assets_from(client, meta, meta_dir,
  assets_base) so tests can route per-asset CDN downloads through a
  wiremock server. download_assets delegates to it with
  ASSETS_BASE_URL.

tests/net_loaders.rs adds eight wiremock tests covering each new
fetcher and a happy + error case for neoforge's invalid-game-version
branch. tests/net_mojang.rs gains download_assets_from_writes_index_and_assets
which now exercises the full per-asset download path against synthetic
hashes.

Production touches are minimal (one new pub fn delegating to the
existing one for each fetcher). Behaviour of existing callers is
unchanged.
2026-05-27 18:03:57 +02:00
objz 363ada8211 refactored: review findings - style and abstraction cleanup
- drop stale phase planning comments from launch_profile module headers.
 - simplify merge_libraries to HashSet<&str> (no string clones).
 - rewrite coord_key with match_indices (clearer intent).
 - read /proc/sys/kernel/osrelease on linux for mojang_os_version
   instead of shelling out to uname; return empty elsewhere.
 - add comment explaining why is_retryable excludes Parse.
 - shorten the launch_profile::... paths in launch/mod.rs with top-level
   use statements.
 - derive Default on LaunchProfile + nested types so test fixtures use
   ..Default::default() instead of listing every None field.
 - inline account_can_launch at its single call site, delete the helper
   and three tests that exercised trivially-correct one-line logic.
 - extract get_json_with_raw on HttpClient and save_profile_bytes in
   instance::loader; collapses three near-identical fetch_X_profile_with_raw
   helpers and three near-identical 'create dir + write bytes' blocks.
2026-05-25 19:05:48 +02:00
objz a7b378b17d added: Fabric/Quilt raw-bytes profile storage + migration fix
stop re-serializing FabricProfile/QuiltProfile through narrow structs;
new fetch_X_profile_with_raw helpers return both the parsed shape (for
library downloads) and the upstream bytes (written byte-for-byte to the
loader-profiles cache). also fixes a latent issue surfaced by the
change: the legacy-loader migration predicate now skips Fabric and Quilt
explicitly since their upstream shape matches the predicate but they
have no installer JSON to recover from.
2026-05-25 16:56:13 +02:00
objz 52787b57c7 fix: switch default profile to terminal and fixed some comments 2026-04-18 19:44:59 +02:00
objz 47dad69321 refactor: upgrade crates and restructure project 2026-04-18 16:59:27 +02:00
objz 9751243b3a fix: replace assert! with panic! for clippy 2026-02-22 16:02:35 +01:00
objz 80210364d5 feat(theme): add palette system and per-element theming 2026-01-24 19:18:09 +01:00
objz 46087c47a8 feat(tui): instance launching, tabs, profiles overhaul 2025-11-01 14:22:18 +01:00
objz 5177f078a9 feat: fetch game versions from loader APIs 2025-08-30 15:08:22 +02:00
objz abacb830bc feat: add shared meta dir for downloads, skip cached 2025-08-09 15:46:08 +02:00
objz cc97c174c1 refactor: extract java and maven helpers to net module 2025-08-09 14:38:19 +02:00
objz 252fe8e44a feat: add download clients for Mojang API and mod loaders 2025-07-19 15:14:07 +02:00