-
Notifications
You must be signed in to change notification settings - Fork 814
将 authlib-injector 嵌入启动器 #4246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
将 authlib-injector 嵌入启动器 #4246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request embeds authlib-injector directly into the launcher instead of downloading it at runtime. The change improves reliability by ensuring authlib-injector is always available and eliminates potential download failures or network dependency issues during authentication.
- Adds authlib-injector as an embedded resource in the JAR file
- Replaces the AuthlibInjectorDownloader with an AuthlibInjectorExtractor that extracts the embedded JAR when needed
- Removes update checking functionality since the embedded version is fixed to the build
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| gradle/libs.versions.toml | Adds authlib-injector dependency definition |
| HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorExtractor.java | New class that extracts embedded authlib-injector from resources |
| HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java | Updates provider creation logic and removes download/update functionality |
| HMCL/build.gradle.kts | Configures build to embed authlib-injector JAR and set version in manifest |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| public AuthlibInjectorExtractor(URL source, Path artifactLocation) { | ||
| if (source == null) | ||
| throw new IllegalArgumentException("Missing authlib injector"); |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message "Missing authlib injector" is not descriptive enough. Consider a more specific message like "Authlib injector source URL cannot be null" to help with debugging.
| throw new IllegalArgumentException("Missing authlib injector"); | |
| throw new IllegalArgumentException("Authlib injector source URL cannot be null"); |
HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorExtractor.java
Outdated
Show resolved
Hide resolved
|
|
||
| String authlibInjectorVersion = JarUtils.getManifestAttribute("Authlib-Injector-Version", null); | ||
| if (authlibInjectorVersion == null) | ||
| throw new AssertionError("Missing Authlib-Injector-Version"); |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message should be more descriptive about where the version should be found. Consider "Missing Authlib-Injector-Version in JAR manifest" to provide better debugging context.
| throw new AssertionError("Missing Authlib-Injector-Version"); | |
| throw new AssertionError("Missing Authlib-Injector-Version in JAR manifest"); |
…/AuthlibInjectorExtractor.java Co-authored-by: Copilot <[email protected]>
Authlib-injector is already bundled into HMCL in HMCL-dev#4246. Due to this, `AuthlibInjectorDownloader` is no longer needed. This commit removes `AuthlibInjectorDownloader`, `AuthlibInjectorDownloadException`, `AuthlibInjectorExtractor`, `AuthlibInjectorArtifactInfo`, and `AuthlibInjectorArtifactProvider` classes, plus the `account.failed.injector_download_failure` i18n key. `AuthlibInjectorArtifactProvider` is replaced with `Supplier<Path>` to provide the jar path of authlib-injector.
No description provided.