Skip to content
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

unmojang: Automatically install authlib-injector when missing #101

Merged
merged 1 commit into from
Sep 24, 2023

Conversation

evan-goode
Copy link
Contributor

Scenario: user tries to launch an instance with an authlib-injector account, but authlib-injector is not installed on the instance.

Current behavior: a dialog box is shown asking whether the user wants to install authlib-injector. If they check "Don't ask again", missing authlib-injector will always be ignored for that instance. If they click "Yes", launching the instance is cancelled and a dialog to select a version of authlib-injector is shown.

Proposed behavior: the checkbox is changed to "Always do the same for all instances without asking" and controls a global setting called "Missing authlib-injector behavior". The "Yes" button automatically installs the latest version of authlib-injector[0] and continues launching the instance. The global "Missing authlib-injector behavior" setting can be set to:

  • Always ask
  • Ignore missing authlib-injector
  • Automatically install authlib-injector

A custom version of authlib-injector can still be installed in the "Edit Instance" menu, as before.

[0] I couldn't get the launcher to choose the latest version, possibly related to yushijinhun/authlib-injector#219. I'd like to fix this before unmojang is merged to develop, but in the meantime I've changed the metadata server to only list the latest version of authlib-injector, currently 1.2.3.

launcher/LaunchController.cpp Fixed Show fixed Hide fixed
launcher/LaunchController.cpp Fixed Show fixed Hide fixed
Copy link
Owner

@fn2006 fn2006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, tested it and it works well.
Only issue is CodeQL complaining that missingBehavior in launcher/LaunchController.cpp is undefined at first, fixing it should be as simple as changing the declaration to int missingBehavior = MissingAuthlibInjectorBehavior::Ask; though.

Add MissingAuthlibInjectorBehavior setting to control this behavior

Signed-off-by: Evan Goode <[email protected]>
@evan-goode evan-goode force-pushed the auto-install-authlib-injector branch 2 times, most recently from 91f0e2d to aa58970 Compare September 23, 2023 23:26
@evan-goode evan-goode requested a review from fn2006 September 24, 2023 00:06
@evan-goode
Copy link
Contributor Author

Yep yep, CodeQL is happy now.

@fn2006 fn2006 merged commit 044980d into fn2006:unmojang Sep 24, 2023
10 of 11 checks passed
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.

2 participants