mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-06-28 12:08:09 +03:00
[FIX] Some bug fixes
This commit is contained in:
parent
b9c6472e2a
commit
0de8ff6e14
4 changed files with 36 additions and 9 deletions
|
@ -343,9 +343,9 @@ public void invoke(String... args) throws Exception {
|
|||
}
|
||||
|
||||
public class LocalProfile implements CompletedProfile {
|
||||
private ClientProfile profile;
|
||||
private HashedDir clientDir;
|
||||
private HashedDir assetDir;
|
||||
private volatile ClientProfile profile;
|
||||
private volatile HashedDir clientDir;
|
||||
private volatile HashedDir assetDir;
|
||||
private Path configPath;
|
||||
|
||||
public LocalProfile(ClientProfile profile, HashedDir clientDir, HashedDir assetDir) {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LauncherBackendImpl implements LauncherBackendAPI, TextureUploadExtension {
|
||||
private final ClientDownloadImpl clientDownloadImpl = new ClientDownloadImpl(this);
|
||||
|
@ -53,7 +54,7 @@ public class LauncherBackendImpl implements LauncherBackendAPI, TextureUploadExt
|
|||
// Hardware
|
||||
private volatile ECKeyHolder ecKeyHolder;
|
||||
// Data
|
||||
private volatile List<ProfileFeatureAPI.ClientProfile> profiles;
|
||||
private volatile Map<UUID, ProfileFeatureAPI.ClientProfile> profiles;
|
||||
private volatile UserPermissions permissions;
|
||||
private volatile SelfUser selfUser;
|
||||
private volatile List<Java> availableJavas;
|
||||
|
@ -184,12 +185,23 @@ public CompletableFuture<SelfUser> authorize(String login, AuthMethodPassword pa
|
|||
@Override
|
||||
public CompletableFuture<List<ProfileFeatureAPI.ClientProfile>> fetchProfiles() {
|
||||
return LauncherAPIHolder.profile().getProfiles().thenApply((profiles) -> {
|
||||
this.profiles = profiles;
|
||||
onProfiles(profiles);
|
||||
callback.onProfiles(profiles);
|
||||
return profiles;
|
||||
});
|
||||
}
|
||||
|
||||
private void onProfiles(List<ProfileFeatureAPI.ClientProfile> profiles) {
|
||||
this.profiles = profiles.stream().collect(Collectors.toMap(ProfileFeatureAPI.ClientProfile::getUUID, x -> x));
|
||||
for(var e : backendSettings.settings.entrySet()) {
|
||||
ClientProfile profile = (ClientProfile) this.profiles.get(e.getKey());
|
||||
if(profile == null) {
|
||||
continue;
|
||||
}
|
||||
e.getValue().initAfterGson(profile, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientProfileSettings makeClientProfileSettings(ProfileFeatureAPI.ClientProfile profile) {
|
||||
var settings = backendSettings.settings.get(profile.getUUID());
|
||||
|
|
|
@ -316,7 +316,7 @@ public boolean hasFlag(CompatibilityFlags flag) {
|
|||
|
||||
public void verify() {
|
||||
// Version
|
||||
getVersion();
|
||||
getMinecraftVersion();
|
||||
IOHelper.verifyFileName(getAssetIndex());
|
||||
|
||||
// Client
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
import pro.gravit.launcher.base.api.AuthService;
|
||||
import pro.gravit.launcher.base.api.ClientService;
|
||||
import pro.gravit.launcher.base.api.KeyService;
|
||||
import pro.gravit.launcher.base.request.*;
|
||||
import pro.gravit.launcher.client.events.*;
|
||||
import pro.gravit.launcher.core.api.LauncherAPI;
|
||||
import pro.gravit.launcher.core.api.LauncherAPIHolder;
|
||||
import pro.gravit.launcher.core.api.features.*;
|
||||
import pro.gravit.launcher.core.backend.LauncherBackendAPIHolder;
|
||||
import pro.gravit.launcher.core.hasher.FileNameMatcher;
|
||||
import pro.gravit.launcher.core.hasher.HashedDir;
|
||||
import pro.gravit.launcher.core.hasher.HashedEntry;
|
||||
|
@ -15,9 +20,6 @@
|
|||
import pro.gravit.launcher.base.profiles.optional.actions.OptionalAction;
|
||||
import pro.gravit.launcher.base.profiles.optional.actions.OptionalActionClassPath;
|
||||
import pro.gravit.launcher.base.profiles.optional.actions.OptionalActionClientArgs;
|
||||
import pro.gravit.launcher.base.request.Request;
|
||||
import pro.gravit.launcher.base.request.RequestException;
|
||||
import pro.gravit.launcher.base.request.RequestService;
|
||||
import pro.gravit.launcher.base.request.websockets.StdWebSocketService;
|
||||
import pro.gravit.launcher.core.serialize.HInput;
|
||||
import pro.gravit.launcher.client.utils.DirWatcher;
|
||||
|
@ -138,6 +140,19 @@ private static void realMain(String[] args) throws Throwable {
|
|||
}
|
||||
};
|
||||
}
|
||||
// Init New API
|
||||
LauncherAPIHolder.setCoreAPI(new RequestCoreFeatureAPIImpl(Request.getRequestService()));
|
||||
LauncherAPIHolder.setCreateApiFactory((authId) -> {
|
||||
var impl = new RequestFeatureAPIImpl(Request.getRequestService(), authId);
|
||||
return new LauncherAPI(Map.of(
|
||||
AuthFeatureAPI.class, impl,
|
||||
UserFeatureAPI.class, impl,
|
||||
ProfileFeatureAPI.class, impl,
|
||||
TextureUploadFeatureAPI.class, impl,
|
||||
HardwareVerificationFeatureAPI.class, impl));
|
||||
});
|
||||
LauncherAPIHolder.changeAuthId(params.authId);
|
||||
//
|
||||
LogHelper.debug("Natives dir %s", params.nativesDir);
|
||||
ClientProfile.ClassLoaderConfig classLoaderConfig = profile.getClassLoaderConfig();
|
||||
LaunchOptions options = new LaunchOptions();
|
||||
|
|
Loading…
Reference in a new issue