mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] @LauncherNetworkAPI
This commit is contained in:
parent
746fdc36e4
commit
7f062e720a
15 changed files with 60 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
package ru.gravit.launchserver.socket.websocket.json.auth;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import ru.gravit.launcher.events.request.CheckServerEvent;
|
||||
import ru.gravit.launcher.events.request.CheckServerRequestEvent;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.auth.AuthException;
|
||||
import ru.gravit.launchserver.response.profile.ProfileByUUIDResponse;
|
||||
|
@ -22,7 +22,7 @@ public String getType() {
|
|||
|
||||
@Override
|
||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client pClient) {
|
||||
CheckServerEvent result = new CheckServerEvent();
|
||||
CheckServerRequestEvent result = new CheckServerRequestEvent();
|
||||
try {
|
||||
result.uuid = LaunchServer.server.config.authHandler.checkServer(username, serverID);
|
||||
if(result.uuid != null)
|
||||
|
@ -35,7 +35,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
|||
service.sendObject(ctx, new WebSocketService.ErrorResult("Internal authHandler error"));
|
||||
return;
|
||||
}
|
||||
service.sendObject(ctx, new CheckServerEvent());
|
||||
service.sendObject(ctx, new CheckServerRequestEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
<methods>;
|
||||
}
|
||||
|
||||
-keepclassmembers @ru.gravit.launcher.LauncherNetworkAPI class ** {
|
||||
<fields>;
|
||||
<methods>;
|
||||
}
|
||||
|
||||
-keepclassmembers class ** {
|
||||
@ru.gravit.launcher.LauncherAPI
|
||||
<fields>;
|
||||
|
@ -38,6 +43,13 @@
|
|||
<methods>;
|
||||
}
|
||||
|
||||
-keepclassmembers class ** {
|
||||
@ru.gravit.launcher.LauncherNetworkAPI
|
||||
<fields>;
|
||||
@ru.gravit.launcher.LauncherNetworkAPI
|
||||
<methods>;
|
||||
}
|
||||
|
||||
-keepclassmembers public class ** {
|
||||
public static void main(java.lang.String[]);
|
||||
public static void premain(java.lang.String, java.lang.instrument.Instrumentation);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.events.request.CheckServerEvent;
|
||||
import ru.gravit.launcher.events.request.CheckServerRequestEvent;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.Request;
|
||||
import ru.gravit.launcher.request.RequestType;
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class CheckServerRequest extends Request<CheckServerEvent> {
|
||||
public final class CheckServerRequest extends Request<CheckServerRequestEvent> {
|
||||
private final String username;
|
||||
private final String serverID;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public Integer getType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected CheckServerEvent requestDo(HInput input, HOutput output) throws IOException {
|
||||
protected CheckServerRequestEvent requestDo(HInput input, HOutput output) throws IOException {
|
||||
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
||||
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
|
||||
if (Launcher.profile == null) {
|
||||
|
@ -49,6 +49,6 @@ protected CheckServerEvent requestDo(HInput input, HOutput output) throws IOExce
|
|||
|
||||
// Read response
|
||||
readError(input);
|
||||
return input.readBoolean() ? new CheckServerEvent(new PlayerProfile(input)) : null;
|
||||
return input.readBoolean() ? new CheckServerRequestEvent(new PlayerProfile(input)) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
import ru.gravit.launcher.hasher.HashedEntry;
|
||||
import ru.gravit.launcher.hasher.HashedEntryAdapter;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.launcher.request.auth.JoinServerRequest;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -80,7 +78,7 @@ public void registerResult(String key, Class<? extends ResultInterface> clazz) {
|
|||
public void registerResults() {
|
||||
registerResult("echo", EchoRequestEvent.class);
|
||||
registerResult("auth", AuthRequestEvent.class);
|
||||
registerResult("checkServer", CheckServerEvent.class);
|
||||
registerResult("checkServer", CheckServerRequestEvent.class);
|
||||
registerResult("joinServer", JoinServerRequestEvent.class);
|
||||
registerResult("launcher", LauncherRequestEvent.class);
|
||||
registerResult("profileByUsername", ProfileByUsernameRequestEvent.class);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package ru.gravit.launcher;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
|
||||
public @interface LauncherNetworkAPI {
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.ClientPermissions;
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -11,10 +12,13 @@ public class AuthRequestEvent implements EventInterface, ResultInterface {
|
|||
private static final UUID uuid = UUID.fromString("77e1bfd7-adf9-4f5d-87d6-a7dd068deb74");
|
||||
public AuthRequestEvent() {
|
||||
}
|
||||
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
@LauncherNetworkAPI
|
||||
public ClientPermissions permissions;
|
||||
@LauncherNetworkAPI
|
||||
public PlayerProfile playerProfile;
|
||||
@LauncherNetworkAPI
|
||||
public String accessToken;
|
||||
|
||||
public AuthRequestEvent(PlayerProfile pp, String accessToken, ClientPermissions permissions) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -9,7 +10,9 @@
|
|||
public class BatchProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
@LauncherNetworkAPI
|
||||
public PlayerProfile[] playerProfiles;
|
||||
|
||||
public BatchProfileByUsernameRequestEvent(PlayerProfile[] profiles) {
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CheckServerEvent implements EventInterface, ResultInterface {
|
||||
public class CheckServerRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID _uuid = UUID.fromString("8801d07c-51ba-4059-b61d-fe1f1510b28a");
|
||||
public String type = "success";
|
||||
@LauncherNetworkAPI
|
||||
public UUID uuid;
|
||||
@LauncherNetworkAPI
|
||||
public PlayerProfile playerProfile;
|
||||
|
||||
public CheckServerEvent(PlayerProfile playerProfile) {
|
||||
public CheckServerRequestEvent(PlayerProfile playerProfile) {
|
||||
this.playerProfile = playerProfile;
|
||||
}
|
||||
|
||||
public CheckServerEvent() {
|
||||
public CheckServerRequestEvent() {
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
|
@ -7,6 +8,7 @@
|
|||
|
||||
public class EchoRequestEvent implements ResultInterface, EventInterface {
|
||||
private static final UUID uuid = UUID.fromString("0a1f820f-7cd5-47a5-ae0e-17492e0e1fe1");
|
||||
@LauncherNetworkAPI
|
||||
public String echo;
|
||||
|
||||
public EchoRequestEvent(String echo) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
public class JoinServerRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("2a12e7b5-3f4a-4891-a2f9-ea141c8e1995");
|
||||
public String type = "success";
|
||||
|
||||
public JoinServerRequestEvent(boolean allow) {
|
||||
this.allow = allow;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
||||
|
@ -7,7 +8,7 @@
|
|||
|
||||
public class LauncherRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("d54cc12a-4f59-4f23-9b10-f527fdd2e38f");
|
||||
public String type = "success";
|
||||
@LauncherNetworkAPI
|
||||
public String url;
|
||||
|
||||
public LauncherRequestEvent(boolean needUpdate, String url) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -9,7 +10,9 @@
|
|||
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
@LauncherNetworkAPI
|
||||
public PlayerProfile playerProfile;
|
||||
|
||||
public ProfileByUUIDRequestEvent(PlayerProfile playerProfile) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -9,7 +10,9 @@
|
|||
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
@LauncherNetworkAPI
|
||||
public PlayerProfile playerProfile;
|
||||
|
||||
public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -10,6 +11,7 @@
|
|||
public class ProfilesRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
|
||||
@LauncherNetworkAPI
|
||||
public List<ClientProfile> profiles;
|
||||
|
||||
public ProfilesRequestEvent(List<ClientProfile> profiles) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.gravit.launcher.events.request;
|
||||
|
||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||
import ru.gravit.launcher.hasher.HashedDir;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
import ru.gravit.utils.event.EventInterface;
|
||||
|
@ -8,7 +9,9 @@
|
|||
|
||||
public class UpdateListRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("5fa836ae-6b61-401c-96ac-d8396f07ec6b");
|
||||
@LauncherNetworkAPI
|
||||
public final String type;
|
||||
@LauncherNetworkAPI
|
||||
public final HashedDir dir;
|
||||
|
||||
public UpdateListRequestEvent(HashedDir dir) {
|
||||
|
|
Loading…
Reference in a new issue