Skip to content

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Aug 11, 2025

No description provided.

@Glavo Glavo linked an issue Aug 11, 2025 that may be closed by this pull request
@Glavo Glavo requested a review from Copilot August 13, 2025 07:29
Copy link
Contributor

Copilot AI left a 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");
Copy link

Copilot AI Aug 13, 2025

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.

Suggested change
throw new IllegalArgumentException("Missing authlib injector");
throw new IllegalArgumentException("Authlib injector source URL cannot be null");

Copilot uses AI. Check for mistakes.

String authlibInjectorVersion = JarUtils.getManifestAttribute("Authlib-Injector-Version", null);
if (authlibInjectorVersion == null)
throw new AssertionError("Missing Authlib-Injector-Version");
Copy link

Copilot AI Aug 13, 2025

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.

Suggested change
throw new AssertionError("Missing Authlib-Injector-Version");
throw new AssertionError("Missing Authlib-Injector-Version in JAR manifest");

Copilot uses AI. Check for mistakes.
…/AuthlibInjectorExtractor.java

Co-authored-by: Copilot <[email protected]>
@Glavo Glavo merged commit 0d5d1ae into HMCL-dev:main Aug 13, 2025
2 checks passed
@Glavo Glavo deleted the authlib-injector branch August 13, 2025 07:37
yushijinhun added a commit to yushijinhun/HMCL that referenced this pull request Dec 17, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 将 authlib-injector 捆绑至 HMCL 中

1 participant