[FIX] initAfterGson selectedJava and fix texture upload

This commit is contained in:
Gravita 2025-06-13 17:11:18 +07:00
parent 0a163bb09c
commit cacbbfc8ed
2 changed files with 23 additions and 2 deletions

View file

@ -26,7 +26,7 @@ public class ProfileSettingsImpl implements LauncherBackendAPI.ClientProfileSett
@LauncherNetworkAPI @LauncherNetworkAPI
private String saveJavaPath; private String saveJavaPath;
transient OptionalView view; transient OptionalView view;
transient JavaHelper.JavaVersion selectedJava; transient volatile JavaHelper.JavaVersion selectedJava;
public ProfileSettingsImpl() { public ProfileSettingsImpl() {
} }
@ -203,5 +203,21 @@ public void initAfterGson(ClientProfile profile, LauncherBackendImpl backend) {
} }
enableOptional(opt, (var1, var2) -> {}); enableOptional(opt, (var1, var2) -> {});
} }
if(this.saveJavaPath != null) {
backend.getAvailableJava().thenAccept((javas) -> {
for(var java : javas) {
if(!isCompatible(java)) {
continue;
}
if(java.getPath() == null) {
continue;
}
if(java.getPath().toAbsolutePath().toString().equals(this.saveJavaPath)) {
this.selectedJava = (JavaHelper.JavaVersion) java;
return;
}
}
});
}
} }
} }

View file

@ -1,6 +1,7 @@
package pro.gravit.launcher.base.request; package pro.gravit.launcher.base.request;
import pro.gravit.launcher.base.Launcher; import pro.gravit.launcher.base.Launcher;
import pro.gravit.launcher.base.events.request.AuthRequestEvent;
import pro.gravit.launcher.base.events.request.VerifySecureLevelKeyRequestEvent; import pro.gravit.launcher.base.events.request.VerifySecureLevelKeyRequestEvent;
import pro.gravit.launcher.base.profiles.ClientProfile; import pro.gravit.launcher.base.profiles.ClientProfile;
import pro.gravit.launcher.base.request.auth.*; import pro.gravit.launcher.base.request.auth.*;
@ -62,7 +63,10 @@ public CompletableFuture<AuthResponse> auth(String login, AuthMethodPassword pas
connectType = AuthRequest.ConnectTypes.CLIENT; connectType = AuthRequest.ConnectTypes.CLIENT;
} }
return request.request(new AuthRequest(login, convertAuthPasswordAll(password), authId, false, connectType)) return request.request(new AuthRequest(login, convertAuthPasswordAll(password), authId, false, connectType))
.thenApply(response -> new AuthResponse(response.makeUserInfo(), response.oauth)); .thenApply(response -> {
Request.setOAuth(authId, response.oauth);
return new AuthResponse(response.makeUserInfo(), response.oauth);
});
} }
private AuthRequest.AuthPasswordInterface convertAuthPasswordAll(AuthMethodPassword password) { private AuthRequest.AuthPasswordInterface convertAuthPasswordAll(AuthMethodPassword password) {
@ -166,6 +170,7 @@ public CompletableFuture<SelfUser> restore(String accessToken, boolean fetchUser
} }
return request.request(new RestoreRequest(authId, accessToken, extended, fetchUser)).thenApply(e -> { return request.request(new RestoreRequest(authId, accessToken, extended, fetchUser)).thenApply(e -> {
// TODO: invalidToken process // TODO: invalidToken process
Request.setOAuth(authId, new AuthRequestEvent.OAuthRequestEvent(accessToken, null, 0));
return e.userInfo; return e.userInfo;
}); });
} }