2019-06-02 05:03:08 +03:00
|
|
|
package pro.gravit.launchserver.manangers;
|
2019-04-20 01:03:06 +03:00
|
|
|
|
|
|
|
import com.google.gson.GsonBuilder;
|
2021-04-14 13:22:07 +03:00
|
|
|
import pro.gravit.launcher.events.request.GetAvailabilityAuthRequestEvent;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launcher.managers.GsonManager;
|
2019-08-26 13:24:19 +03:00
|
|
|
import pro.gravit.launcher.modules.events.PreGsonPhase;
|
2020-09-12 09:41:58 +03:00
|
|
|
import pro.gravit.launcher.profiles.optional.actions.OptionalAction;
|
2021-06-18 07:34:32 +03:00
|
|
|
import pro.gravit.launcher.profiles.optional.triggers.OptionalTrigger;
|
2019-07-01 12:59:47 +03:00
|
|
|
import pro.gravit.launcher.request.JsonResultSerializeAdapter;
|
2019-07-01 13:46:49 +03:00
|
|
|
import pro.gravit.launcher.request.WebSocketEvent;
|
2019-09-27 03:31:19 +03:00
|
|
|
import pro.gravit.launcher.request.auth.AuthRequest;
|
2021-04-14 13:22:07 +03:00
|
|
|
import pro.gravit.launcher.request.auth.GetAvailabilityAuthRequest;
|
2021-05-16 16:07:44 +03:00
|
|
|
import pro.gravit.launchserver.auth.core.AuthCoreProvider;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
2021-05-19 22:18:01 +03:00
|
|
|
import pro.gravit.launchserver.auth.password.PasswordVerifier;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
2020-05-18 15:26:38 +03:00
|
|
|
import pro.gravit.launchserver.auth.protect.hwid.HWIDProvider;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
2020-12-15 15:27:38 +03:00
|
|
|
import pro.gravit.launchserver.auth.session.SessionStorage;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
|
|
|
import pro.gravit.launchserver.components.Component;
|
2019-07-01 11:22:48 +03:00
|
|
|
import pro.gravit.launchserver.dao.provider.DaoProvider;
|
2019-08-26 13:24:19 +03:00
|
|
|
import pro.gravit.launchserver.modules.impl.LaunchServerModulesManager;
|
2019-07-01 12:59:47 +03:00
|
|
|
import pro.gravit.launchserver.socket.WebSocketService;
|
2020-06-22 07:20:42 +03:00
|
|
|
import pro.gravit.launchserver.socket.response.UnknownResponse;
|
2019-07-01 13:46:49 +03:00
|
|
|
import pro.gravit.launchserver.socket.response.WebSocketServerResponse;
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.utils.UniversalJsonAdapter;
|
2019-04-20 01:03:06 +03:00
|
|
|
|
|
|
|
public class LaunchServerGsonManager extends GsonManager {
|
2019-08-26 13:24:19 +03:00
|
|
|
private final LaunchServerModulesManager modulesManager;
|
|
|
|
|
|
|
|
public LaunchServerGsonManager(LaunchServerModulesManager modulesManager) {
|
|
|
|
this.modulesManager = modulesManager;
|
|
|
|
}
|
|
|
|
|
2019-04-20 01:03:06 +03:00
|
|
|
@Override
|
2021-05-16 16:07:44 +03:00
|
|
|
@SuppressWarnings("deprecation")
|
2019-04-20 01:03:06 +03:00
|
|
|
public void registerAdapters(GsonBuilder builder) {
|
|
|
|
super.registerAdapters(builder);
|
2019-04-20 01:58:59 +03:00
|
|
|
builder.registerTypeAdapter(AuthProvider.class, new UniversalJsonAdapter<>(AuthProvider.providers));
|
|
|
|
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
|
|
|
|
builder.registerTypeAdapter(AuthHandler.class, new UniversalJsonAdapter<>(AuthHandler.providers));
|
2021-05-16 16:07:44 +03:00
|
|
|
builder.registerTypeAdapter(AuthCoreProvider.class, new UniversalJsonAdapter<>(AuthCoreProvider.providers));
|
2021-05-19 22:18:01 +03:00
|
|
|
builder.registerTypeAdapter(PasswordVerifier.class, new UniversalJsonAdapter<>(PasswordVerifier.providers));
|
2019-04-20 01:58:59 +03:00
|
|
|
builder.registerTypeAdapter(Component.class, new UniversalJsonAdapter<>(Component.providers));
|
|
|
|
builder.registerTypeAdapter(ProtectHandler.class, new UniversalJsonAdapter<>(ProtectHandler.providers));
|
2019-07-01 11:22:48 +03:00
|
|
|
builder.registerTypeAdapter(DaoProvider.class, new UniversalJsonAdapter<>(DaoProvider.providers));
|
2020-06-22 07:20:42 +03:00
|
|
|
builder.registerTypeAdapter(WebSocketServerResponse.class, new UniversalJsonAdapter<>(WebSocketService.providers, UnknownResponse.class));
|
2019-07-01 13:46:49 +03:00
|
|
|
builder.registerTypeAdapter(WebSocketEvent.class, new JsonResultSerializeAdapter());
|
2019-09-27 03:31:19 +03:00
|
|
|
builder.registerTypeAdapter(AuthRequest.AuthPasswordInterface.class, new UniversalJsonAdapter<>(AuthRequest.providers));
|
2021-04-14 13:22:07 +03:00
|
|
|
builder.registerTypeAdapter(GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails.class, new UniversalJsonAdapter<>(GetAvailabilityAuthRequest.providers));
|
2020-05-18 15:26:38 +03:00
|
|
|
builder.registerTypeAdapter(HWIDProvider.class, new UniversalJsonAdapter<>(HWIDProvider.providers));
|
2020-09-12 09:41:58 +03:00
|
|
|
builder.registerTypeAdapter(OptionalAction.class, new UniversalJsonAdapter<>(OptionalAction.providers));
|
2021-06-18 07:34:32 +03:00
|
|
|
builder.registerTypeAdapter(OptionalTrigger.class, new UniversalJsonAdapter<>(OptionalTrigger.providers));
|
2020-12-15 15:27:38 +03:00
|
|
|
builder.registerTypeAdapter(SessionStorage.class, new UniversalJsonAdapter<>(SessionStorage.providers));
|
2019-08-26 13:24:19 +03:00
|
|
|
modulesManager.invokeEvent(new PreGsonPhase(builder));
|
2019-07-03 10:23:26 +03:00
|
|
|
//ClientWebSocketService.appendTypeAdapters(builder);
|
2019-04-20 01:03:06 +03:00
|
|
|
}
|
|
|
|
}
|