Repository navigation
Conversation
added 5 commits
October 29, 2026 16:07
A malformed `minecraftWorkbench.proxy`/`http.proxy` value, a proxy scheme other than HTTP(S)/SOCKS5, or a corrupt `proxyCredentials` secret made `activate()` throw: `new URL` or `new ProxyAgent` failed before any view, command or status item was registered, so the whole extension disappeared without an error the user could act on. Credential merging and proxy validation now happen in `src/proxy.ts`, which reports invalid input instead of throwing, and the network layer is created with a last-resort fallback to a direct connection. Both cases surface as a warning so the setting stays discoverable.
Both request paths hard-coded `MinecraftWorkbench/0.3.1` while the manifest already declares 0.3.3, so Mojang, Modrinth and CDN logs would keep showing a stale client version forever. The value now comes from the installed manifest through `vscode.extensions` and is passed into `Network`, which also prevents the two copies from diverging again.
`instance.name.replace(/[^\\w.-]/g, '_')` treats every non-ASCII letter as illegal, so exporting an instance called 我的世界 or サーバー用 offered a file named `_________.mrpack`. Only characters that Windows and macOS actually reject are rewritten now; leading and trailing dots, over-long names and the DOS device names (CON, LPT1, ...) are handled too, so the suggestion is a name the platform will accept.
`conflicts()` called `net.json` directly for every installed mod, so the five minute cache that every other request in this module uses was bypassed: a second Check conflicts run re-fetched everything, and a large pack paid one round trip per mod. The lookups now go through `version()` and are issued together, while the warnings are assembled per mod, so the local-then-online ordering of the previous sequential loop stays the same.
Only the direct connection passed `connections: concurrency`, so HTTP and
SOCKS proxies kept undici's default (unbounded) client pool. Bulk work such
as the installed-mod conflict check then opened one connection per request
through the tunnel.
Both proxy branches now carry the limit:
- the SOCKS agent gets `connections` in its options;
- ProxyAgent is constructed with the object form, `{ uri, connections }`,
because the string form only accepts a URI.
undici 7.29 forwards the value: proxy-agent.js:168 spreads the constructor
options into its inner Agent, agent.js:48 keeps them in kOptions, and the
per-origin factory reaches defaultAgentFactory/Pool, which stops creating
clients at `connections` (pool.js:110). Credentials embedded in the proxy
URI keep working with the object form - ProxyAgent still runs `new URL(uri)`
and derives proxy-authorization from its username/password.
Owner
|
Thanks a lot for the contribution!!!! Preserving non-ASCII export filenames and reusing cached Modrinth metadata during conflict checks are useful improvements. However, I can’t merge this PR as-is. Invalid proxy settings can cause requests to bypass the proxy, some Windows reserved filenames remain invalid, and offline conflict checks no longer stop requesting metadata after a network failure. The branch is also based on v0.3.3 and conflicts with the current codebase. The hard-coded extension ID and network changes need compatibility adjustments, while some fixes are already present in the current version. I’ll adapt the useful improvements and address these issues in the next release. |
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.
Five independent defects, each with a user-visible consequence. All patches were written against the unmodified v0.3.3 tree and verified on a clean checkout.
Why
activate()rannew URL(proxy)andJSON.parse(credentials)on theminecraftWorkbench.proxy/http.proxyvalue and the stored secret. A malformed URL, a scheme other than HTTP(S)/SOCKS5, or a corrupt secret threw before any view, command or status item was registered, so the extension disappeared with nothing actionable in the UI.src/network.tshard-codedMinecraftWorkbench/0.3.1in both request paths while the manifest already declared 0.3.3, so Mojang, Modrinth and CDN logs showed a stale client version forever.instance.name.replace(/[^\w.-]/g, '_')insrc/ui.tstreats every non-ASCII letter as illegal:我的世界became_________.mrpack, and names such asCON/LPT1produced files Windows rejects.conflicts()callednet.json()directly for every installed mod instead ofversion(), so the five minute cache every other request insrc/content.tsuses was never hit: a second run re-fetched everything, and a large pack paid one sequential round trip per mod.downloadConcurrency. Only the direct branch passedconnections: concurrency; HTTP(S) (ProxyAgent) and SOCKS (Agent+ socks) kept undici's default unbounded client pool, so bulk work opened one tunnel connection per request.What changed
fix(lifecycle)src/proxy.tswith aresolveProxy()pure function that reports invalid input instead of throwing; credentials are merged only when they parse.createNetwork()falls back to a direct connection and warns once, so activation always completes.fix(network)src/user-agent.tsreads the version fromvscode.extensions.getExtension(...).packageJSON.version;Networktakes auserAgentoption and both request paths use it.fix(ui)suggestedFilename()insrc/files.tsrewrites only characters Windows and macOS actually reject, and handles leading/trailing dots, over-long names, empty names and DOS device names. BothdefaultUricalls insrc/ui.tsuse it.perf(content)conflicts()goes throughversion()(cached) and issues the lookups together; warnings are assembled per mod so the original local-then-online ordering is preserved exactly.perf(network)connections;ProxyAgentis constructed with the object form{ uri, connections }, since the string form only accepts a URI.Stacking
fix(lifecycle)→fix(network)→perf(network)are stacked: the later commits touch code the first one introduces (createNetwork(),this.userAgent).fix(ui)andperf(content)are independent of the others and can be cherry-picked on their own. Happy to split this into separate PRs if that is easier to review — just say how you would like it.Verification
npm test: 44/44 (36 existing, plustest/proxy.test.ts,test/user-agent.test.ts, additions totest/files.test.tsandtest/content.test.ts)tsc --noEmit,format:check,legal --check,compile— all cleangit amof all five patches,npm ci, then tsc and the full suite: greenpackage.jsonis untouchedDeliberately not included
instance-settings.ts:32only compares min and max when both are set, sominMemory: 8192with an automatic maximum passes the form and fails when the game starts.accounts.tsretries a failed background token refresh every 60 s indefinitely.Both are real, but a proper fix needs the recommendation context plumbed into the validator, and changes to the auth state machine respectively. I left them out to keep this reviewable.