feat(desktop): identify Nexus mods by content and archive hash - #30
Merged
Conversation
Nexus's fileHash lookup keys on the MD5 of the whole published archive, not the extracted-content SHA256 Modrex already computes. Add compute_md5 mirroring compute_sha256's streaming pattern, and add the md-5 crate.
Add identify_mod_via_nexus_content: a user-initiated command that runs Step 5's content matcher against one installed, unidentified mod. Skips mods already identified or already marked missed, so a permanent miss (~25% of mods are never indexed) is asked at most once. Adds InstalledMod.nexus_content_missed to persist that. Reuses the existing rate limiter; never runs on the get_installed hot path.
install_dropped_file now tries Nexus identification automatically
when the drop is a real archive (not a bare loose .pak) for a
Nexus-capable game: MD5-hashes the whole archive, looks it up via
Nexus's fileHash index, and on a unique match installs the entry
already identified (real name, version, author, thumbnail) instead
of as unidentified. uid switches to Tier 1's own
'nexus:{mod_id}:{file_id}' scheme so a later nxm:// install of the
same file reconciles onto this entry instead of duplicating it.
Ambiguous, not-found, or any lookup failure falls straight through
to the existing unidentified-install path - this only ever adds an
identity, never blocks or fails an install.
Extract apply_nexus_archive_identity as a pure, tested function
mapping a confirmed Nexus match onto an InstalledMod, separate from
the async orchestration around it.
Deploying modrex-site-monorepo-preview with
|
| Latest commit: |
0081624
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a53ec3c0.modrex-site-monorepo-preview.pages.dev |
| Branch Preview URL: | https://feat-nexus-mod-identificatio.modrex-site-monorepo-preview.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nexus Mods installs get automatic identification everywhere ModWorkshop already had it, closing the gap that made the Nexus mod counter, update checks, and thumbnails silently unavailable for a large share of installed mods:
install_dropped_filenow MD5-hashes the whole archive and checks it against Nexus'sfileHashindex at install time. A unique match installs the mod already identified (real name, version, author, thumbnail) instead of as "Unknown"; ambiguous or unmatched archives fall through to the existing unidentified-install path unchanged.modFileContents) matches a mod's on-disk filename+size (File-unit games) or folder name (Directory-unit games) against Nexus's published file listings. Runs automatically once per mod the first time it's discovered unidentified (staggered, yields to foreground activity, never on theget_installedhot path), and can be retried on demand from a mod's options menu ("Identify").Two real bugs found and fixed via live testing against real downloaded mods:
install_dropped_filewas naming every archive-wrapped drop after the outer downloaded file (Nexus's own download-manager filename scheme) instead of the mod's real internal name — this also fed garbage into the new content-matching queries. Fixed by recovering the real name from the archive's own pak entry / extracted folder name.fileSizeas a strict filter to Nexus alongsidefileName. A mod's currently-published file is often a newer upload than what's installed locally, so an exact byte-size match silently rejected an otherwise-uniquefileNamematch.fileSizeis now only used to disambiguate client-side whenfileNamealone returns more than one candidate, never sent as a request filter.Also adds
nexusDomainto the shared@modrex/gamesregistry (cross-checked against Rust'sSOURCE_REGISTRYbycheck-sources.mjs) so the site can query Nexus without needing desktop's IPC.Test plan
cargo testpnpm test:renderercargo clippycargo fmt --checkpnpm typecheck,pnpm lint,pnpm format:checkcheck-commands,check-i18n,check-csp,check-sources