diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/LaunchServerGsonManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/LaunchServerGsonManager.java index dc2b312f..069a1960 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/LaunchServerGsonManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/LaunchServerGsonManager.java @@ -11,18 +11,18 @@ import ru.gravit.launchserver.auth.texture.TextureProvider; import ru.gravit.launchserver.components.Component; import ru.gravit.utils.UniversalJsonAdapter; +import ru.gravit.utils.helper.LogHelper; public class LaunchServerGsonManager extends GsonManager { @Override public void registerAdapters(GsonBuilder builder) { super.registerAdapters(builder); - Launcher.gsonManager.gsonBuilder = new GsonBuilder(); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(AuthProvider.class, new UniversalJsonAdapter<>(AuthProvider.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(AuthHandler.class, new UniversalJsonAdapter<>(AuthHandler.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(PermissionsHandler.class, new UniversalJsonAdapter<>(PermissionsHandler.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(HWIDHandler.class, new UniversalJsonAdapter<>(HWIDHandler.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(Component.class, new UniversalJsonAdapter<>(Component.providers)); - Launcher.gsonManager.gsonBuilder.registerTypeAdapter(ProtectHandler.class, new UniversalJsonAdapter<>(ProtectHandler.providers)); + builder.registerTypeAdapter(AuthProvider.class, new UniversalJsonAdapter<>(AuthProvider.providers)); + builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers)); + builder.registerTypeAdapter(AuthHandler.class, new UniversalJsonAdapter<>(AuthHandler.providers)); + builder.registerTypeAdapter(PermissionsHandler.class, new UniversalJsonAdapter<>(PermissionsHandler.providers)); + builder.registerTypeAdapter(HWIDHandler.class, new UniversalJsonAdapter<>(HWIDHandler.providers)); + builder.registerTypeAdapter(Component.class, new UniversalJsonAdapter<>(Component.providers)); + builder.registerTypeAdapter(ProtectHandler.class, new UniversalJsonAdapter<>(ProtectHandler.providers)); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/LauncherResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/LauncherResponse.java index f31aa3b9..add47b6f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/LauncherResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/websocket/json/update/LauncherResponse.java @@ -37,14 +37,14 @@ public void execute(ChannelHandlerContext ctx, Client client) { if (hash == null) service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, JAR_URL)); if (Arrays.equals(bytes, hash)) { client.checkSign = true; - service.sendObject(ctx, new LauncherRequestEvent(false, JAR_URL)); + sendResult(new LauncherRequestEvent(false, JAR_URL)); } else { - service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, JAR_URL)); + sendResultAndClose(new LauncherRequestEvent(true, JAR_URL)); } } else if (launcher_type == 2) //EXE { byte[] hash = LaunchServer.server.launcherEXEBinary.getBytes().getDigest(); - if (hash == null) service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, EXE_URL)); + if (hash == null) sendResultAndClose(new LauncherRequestEvent(true, EXE_URL)); if (Arrays.equals(bytes, hash)) { client.checkSign = true; sendResult(new LauncherRequestEvent(false, EXE_URL)); diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java index 5eab8915..862aef60 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/WaitEventHandler.java @@ -18,11 +18,14 @@ public void process(ResultInterface result) { { RequestEvent event = (RequestEvent) result; checkUUID = event.requestUUID; + if(checkUUID != null) + LogHelper.debug("Event UUID: %s found", checkUUID.toString()); } for (ResultEvent r : requests) { - if( (r.uuid != null && r.uuid.equals(checkUUID)) || ( r.uuid == null && (r.type.equals(result.getType()) || result.getType().equals("error") )) ) { + if(r.uuid != null) + LogHelper.debug("Request UUID found: %s", r.uuid.toString()); + if( (r.uuid != null && r.uuid.equals(checkUUID)) || ( checkUUID == null && (r.type.equals(result.getType()) || result.getType().equals("error") )) ) { LogHelper.debug("Event %s type", r.type); - LogHelper.debug("Event UUID contains: %s", (r.uuid != null && r.uuid.equals(checkUUID)) ? "true" : "false"); synchronized (r) { r.result = result; r.ready = true; diff --git a/libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java b/libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java index ce32eef1..0e244d98 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java +++ b/libLauncher/src/main/java/ru/gravit/utils/ProviderMap.java @@ -1,5 +1,6 @@ package ru.gravit.utils; +import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.VerifyHelper; import java.util.Map; diff --git a/libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java b/libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java index 4cd66670..00b864ab 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java +++ b/libLauncher/src/main/java/ru/gravit/utils/UniversalJsonAdapter.java @@ -6,11 +6,12 @@ import java.lang.reflect.Type; public class UniversalJsonAdapter implements JsonSerializer, JsonDeserializer { - public ProviderMap providerMap; - public String PROP_NAME = "type"; + public final ProviderMap providerMap; + public final String PROP_NAME; public UniversalJsonAdapter(ProviderMap providerMap) { this.providerMap = providerMap; + this.PROP_NAME = "type"; } public UniversalJsonAdapter(ProviderMap providerMap, String PROP_NAME) { @@ -22,7 +23,7 @@ public R deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString(); Class cls = providerMap.getProviderClass(typename); if (cls == null) { - LogHelper.error("AuthHandler %s not found", typename); + LogHelper.error("Provider %s not found", typename); return null; } return context.deserialize(json, cls);