[FIX] Bug fixes

This commit is contained in:
Gravita 2021-04-14 17:22:07 +07:00
parent 7886cce6f8
commit 5bbe63f78c
5 changed files with 21 additions and 0 deletions

View file

@ -1,12 +1,14 @@
package pro.gravit.launchserver.manangers;
import com.google.gson.GsonBuilder;
import pro.gravit.launcher.events.request.GetAvailabilityAuthRequestEvent;
import pro.gravit.launcher.managers.GsonManager;
import pro.gravit.launcher.modules.events.PreGsonPhase;
import pro.gravit.launcher.profiles.optional.actions.OptionalAction;
import pro.gravit.launcher.request.JsonResultSerializeAdapter;
import pro.gravit.launcher.request.WebSocketEvent;
import pro.gravit.launcher.request.auth.AuthRequest;
import pro.gravit.launcher.request.auth.GetAvailabilityAuthRequest;
import pro.gravit.launchserver.auth.handler.AuthHandler;
import pro.gravit.launchserver.auth.protect.ProtectHandler;
import pro.gravit.launchserver.auth.protect.hwid.HWIDProvider;
@ -40,6 +42,7 @@ public void registerAdapters(GsonBuilder builder) {
builder.registerTypeAdapter(WebSocketServerResponse.class, new UniversalJsonAdapter<>(WebSocketService.providers, UnknownResponse.class));
builder.registerTypeAdapter(WebSocketEvent.class, new JsonResultSerializeAdapter());
builder.registerTypeAdapter(AuthRequest.AuthPasswordInterface.class, new UniversalJsonAdapter<>(AuthRequest.providers));
builder.registerTypeAdapter(GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails.class, new UniversalJsonAdapter<>(GetAvailabilityAuthRequest.providers));
builder.registerTypeAdapter(HWIDProvider.class, new UniversalJsonAdapter<>(HWIDProvider.providers));
builder.registerTypeAdapter(OptionalAction.class, new UniversalJsonAdapter<>(OptionalAction.providers));
builder.registerTypeAdapter(SessionStorage.class, new UniversalJsonAdapter<>(SessionStorage.providers));

View file

@ -26,6 +26,7 @@ public class ClientLauncherWrapper {
public static int launcherMemoryLimit;
public static void main(String[] arguments) throws IOException, InterruptedException {
System.setProperty("launcher.noSlf4j", "true"); //TODO: Normal fix
LogHelper.printVersion("Launcher");
LogHelper.printLicense("Launcher");
JVMHelper.checkStackTrace(ClientLauncherWrapper.class);
@ -70,6 +71,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
args.add(JVMHelper.jvmProperty(LogHelper.STACKTRACE_PROPERTY, Boolean.toString(LogHelper.isStacktraceEnabled())));
args.add(JVMHelper.jvmProperty(LogHelper.DEV_PROPERTY, Boolean.toString(LogHelper.isDevEnabled())));
args.add(JVMHelper.jvmProperty("launcher.noSlf4j", "true")); //TODO: Normal fix
JVMHelper.addSystemPropertyToArgs(args, DirBridge.CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_OPTDIR_PROPERTY);

View file

@ -76,6 +76,7 @@ public static void registerProviders() {
providers.register("rsa", AuthECPassword.class);
providers.register("aes", AuthAESPassword.class);
providers.register("2fa", Auth2FAPassword.class);
providers.register("multi", AuthMultiPassword.class);
providers.register("signature", AuthSignaturePassword.class);
providers.register("totp", AuthTOTPPassword.class);
providers.register("oauth", AuthOAuthPassword.class);

View file

@ -0,0 +1,13 @@
package pro.gravit.launcher.request.auth.password;
import pro.gravit.launcher.request.auth.AuthRequest;
import java.util.List;
public class AuthMultiPassword implements AuthRequest.AuthPasswordInterface {
public List<AuthRequest.AuthPasswordInterface> list;
@Override
public boolean check() {
return list != null && list.stream().allMatch(l -> l != null && l.check());
}
}

View file

@ -12,6 +12,7 @@
import pro.gravit.launcher.profiles.optional.actions.OptionalAction;
import pro.gravit.launcher.request.WebSocketEvent;
import pro.gravit.launcher.request.auth.AuthRequest;
import pro.gravit.launcher.request.auth.GetAvailabilityAuthRequest;
import pro.gravit.utils.ProviderMap;
import pro.gravit.utils.UniversalJsonAdapter;
import pro.gravit.utils.helper.LogHelper;
@ -41,6 +42,7 @@ public static void appendTypeAdapters(GsonBuilder builder) {
builder.registerTypeAdapter(WebSocketEvent.class, new UniversalJsonAdapter<>(ClientWebSocketService.results));
builder.registerTypeAdapter(WebSocketRequest.class, new UniversalJsonAdapter<>(ClientWebSocketService.requests));
builder.registerTypeAdapter(AuthRequest.AuthPasswordInterface.class, new UniversalJsonAdapter<>(AuthRequest.providers));
builder.registerTypeAdapter(GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails.class, new UniversalJsonAdapter<>(GetAvailabilityAuthRequest.providers));
builder.registerTypeAdapter(OptionalAction.class, new UniversalJsonAdapter<>(OptionalAction.providers));
}