mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE] Поддержка requestUUID ля определения к какому запросу принадлежит ответ
This commit is contained in:
parent
3a160659d4
commit
58858a0290
40 changed files with 166 additions and 95 deletions
|
@ -16,6 +16,7 @@
|
||||||
import ru.gravit.launchserver.websocket.json.EchoResponse;
|
import ru.gravit.launchserver.websocket.json.EchoResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseAdapter;
|
import ru.gravit.launchserver.websocket.json.JsonResponseAdapter;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.admin.AddLogListenerResponse;
|
import ru.gravit.launchserver.websocket.json.admin.AddLogListenerResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.admin.ExecCommandResponse;
|
import ru.gravit.launchserver.websocket.json.admin.ExecCommandResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.auth.*;
|
import ru.gravit.launchserver.websocket.json.auth.*;
|
||||||
|
@ -54,8 +55,15 @@ public WebSocketService(ChannelGroup channels, LaunchServer server, GsonBuilder
|
||||||
void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client) {
|
void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client) {
|
||||||
String request = frame.text();
|
String request = frame.text();
|
||||||
JsonResponseInterface response = gson.fromJson(request, JsonResponseInterface.class);
|
JsonResponseInterface response = gson.fromJson(request, JsonResponseInterface.class);
|
||||||
|
if(response instanceof SimpleResponse)
|
||||||
|
{
|
||||||
|
SimpleResponse simpleResponse = (SimpleResponse) response;
|
||||||
|
simpleResponse.server = server;
|
||||||
|
simpleResponse.service = this;
|
||||||
|
simpleResponse.ctx = ctx;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
response.execute(this, ctx, client);
|
response.execute(ctx, client);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
sendObject(ctx, new ExceptionResult(e));
|
sendObject(ctx, new ExceptionResult(e));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class EchoResponse implements JsonResponseInterface {
|
public class EchoResponse extends SimpleResponse {
|
||||||
public final String echo;
|
public final String echo;
|
||||||
|
|
||||||
public EchoResponse(String echo) {
|
public EchoResponse(String echo) {
|
||||||
|
@ -19,9 +19,8 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
LogHelper.info("Echo: %s, isAuth %s", echo, client.isAuth ? "true" : "false");
|
LogHelper.info("Echo: %s, isAuth %s", echo, client.isAuth ? "true" : "false");
|
||||||
service.sendObject(ctx, new EchoRequestEvent(echo));
|
service.sendObject(ctx, new EchoRequestEvent(echo));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
public interface JsonResponseInterface {
|
public interface JsonResponseInterface {
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception;
|
void execute(ChannelHandlerContext ctx, Client client) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,39 @@
|
||||||
package ru.gravit.launchserver.websocket.json;
|
package ru.gravit.launchserver.websocket.json;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
|
import ru.gravit.launcher.events.request.ErrorRequestEvent;
|
||||||
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
|
|
||||||
public class SimpleResponse implements JsonResponseInterface {
|
import java.util.UUID;
|
||||||
@Override
|
|
||||||
public String getType() {
|
public abstract class SimpleResponse implements JsonResponseInterface {
|
||||||
return null;
|
public UUID requestUUID;
|
||||||
|
public transient LaunchServer server;
|
||||||
|
public transient WebSocketService service;
|
||||||
|
public transient ChannelHandlerContext ctx;
|
||||||
|
public void sendResult(RequestEvent result)
|
||||||
|
{
|
||||||
|
result.requestUUID = requestUUID;
|
||||||
|
service.sendObject(ctx, result);
|
||||||
|
}
|
||||||
|
public void sendResultAndClose(RequestEvent result)
|
||||||
|
{
|
||||||
|
result.requestUUID = requestUUID;
|
||||||
|
service.sendObjectAndClose(ctx, result);
|
||||||
|
}
|
||||||
|
public void sendError(String errorMessage)
|
||||||
|
{
|
||||||
|
ErrorRequestEvent event = new ErrorRequestEvent(errorMessage);
|
||||||
|
event.requestUUID = requestUUID;
|
||||||
|
service.sendObject(ctx, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
import ru.gravit.launcher.events.request.LogEvent;
|
import ru.gravit.launcher.events.request.LogEvent;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class AddLogListenerResponse implements JsonResponseInterface {
|
public class AddLogListenerResponse extends SimpleResponse {
|
||||||
public LogHelper.OutputTypes outputType = LogHelper.OutputTypes.PLAIN;
|
public LogHelper.OutputTypes outputType = LogHelper.OutputTypes.PLAIN;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,13 +17,13 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
if (!client.isAuth) {
|
if (!client.isAuth) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!client.permissions.canAdmin) {
|
if (!client.permissions.canAdmin) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (client.logOutput != null) {
|
if (client.logOutput != null) {
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
public class ExecCommandResponse implements JsonResponseInterface {
|
public class ExecCommandResponse extends SimpleResponse {
|
||||||
public String cmd;
|
public String cmd;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,12 +18,12 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
if (!client.isAuth || !client.permissions.canAdmin) {
|
if (!client.isAuth || !client.permissions.canAdmin) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LaunchServer.server.commandHandler.eval(cmd, false);
|
LaunchServer.server.commandHandler.eval(cmd, false);
|
||||||
service.sendObject(ctx, new ExecCommandRequestEvent(true));
|
sendResult(new ExecCommandRequestEvent(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse;
|
import ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AuthResponse implements JsonResponseInterface {
|
public class AuthResponse extends SimpleResponse {
|
||||||
public transient static Random random = new SecureRandom();
|
public transient static Random random = new SecureRandom();
|
||||||
public String login;
|
public String login;
|
||||||
public String client;
|
public String client;
|
||||||
|
@ -58,7 +59,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client clientData) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client clientData) throws Exception {
|
||||||
try {
|
try {
|
||||||
AuthRequestEvent result = new AuthRequestEvent();
|
AuthRequestEvent result = new AuthRequestEvent();
|
||||||
String ip = IOHelper.getIP(ctx.channel().remoteAddress());
|
String ip = IOHelper.getIP(ctx.channel().remoteAddress());
|
||||||
|
@ -126,9 +127,9 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server, uuid, aresult.username, client, clientData.auth.textureProvider);
|
result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server, uuid, aresult.username, client, clientData.auth.textureProvider);
|
||||||
LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString());
|
LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString());
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, result);
|
sendResult(result);
|
||||||
} catch (AuthException | HWIDException e) {
|
} catch (AuthException | HWIDException e) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent(e.getMessage()));
|
sendError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class AuthContext {
|
public static class AuthContext {
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse;
|
import ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class CheckServerResponse implements JsonResponseInterface {
|
public class CheckServerResponse extends SimpleResponse {
|
||||||
public String serverID;
|
public String serverID;
|
||||||
public String username;
|
public String username;
|
||||||
public String client;
|
public String client;
|
||||||
|
@ -22,7 +23,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client pClient) {
|
public void execute(ChannelHandlerContext ctx, Client pClient) {
|
||||||
CheckServerRequestEvent result = new CheckServerRequestEvent();
|
CheckServerRequestEvent result = new CheckServerRequestEvent();
|
||||||
try {
|
try {
|
||||||
result.uuid = pClient.auth.handler.checkServer(username, serverID);
|
result.uuid = pClient.auth.handler.checkServer(username, serverID);
|
||||||
|
@ -30,14 +31,14 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server, result.uuid, username, client, pClient.auth.textureProvider);
|
result.playerProfile = ProfileByUUIDResponse.getProfile(LaunchServer.server, result.uuid, username, client, pClient.auth.textureProvider);
|
||||||
LogHelper.debug("checkServer: %s uuid: %s serverID: %s", result.playerProfile.username, result.uuid.toString(), serverID);
|
LogHelper.debug("checkServer: %s uuid: %s serverID: %s", result.playerProfile.username, result.uuid.toString(), serverID);
|
||||||
} catch (AuthException e) {
|
} catch (AuthException e) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent(e.getMessage()));
|
sendError(e.getMessage());
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Internal authHandler error"));
|
sendError("Internal authHandler error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, result);
|
sendResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,24 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GetAvailabilityAuthResponse implements JsonResponseInterface {
|
public class GetAvailabilityAuthResponse extends SimpleResponse {
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "getAvailabilityAuth";
|
return "getAvailabilityAuth";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
List<GetAvailabilityAuthRequestEvent.AuthAvailability> list = new ArrayList<>();
|
List<GetAvailabilityAuthRequestEvent.AuthAvailability> list = new ArrayList<>();
|
||||||
for(AuthProviderPair pair : LaunchServer.server.config.auth)
|
for(AuthProviderPair pair : LaunchServer.server.config.auth)
|
||||||
{
|
{
|
||||||
list.add(new GetAvailabilityAuthRequestEvent.AuthAvailability(pair.name, pair.displayName));
|
list.add(new GetAvailabilityAuthRequestEvent.AuthAvailability(pair.name, pair.displayName));
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, new GetAvailabilityAuthRequestEvent(list));
|
sendResult(new GetAvailabilityAuthRequestEvent(list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class JoinServerResponse implements JsonResponseInterface {
|
public class JoinServerResponse extends SimpleResponse {
|
||||||
public String serverID;
|
public String serverID;
|
||||||
public String accessToken;
|
public String accessToken;
|
||||||
public String username;
|
public String username;
|
||||||
|
@ -21,7 +22,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
boolean success;
|
boolean success;
|
||||||
try {
|
try {
|
||||||
if(client.auth == null)
|
if(client.auth == null)
|
||||||
|
@ -32,14 +33,14 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
else success = client.auth.handler.joinServer(username, accessToken, serverID);
|
else success = client.auth.handler.joinServer(username, accessToken, serverID);
|
||||||
LogHelper.debug("joinServer: %s accessToken: %s serverID: %s", username, accessToken, serverID);
|
LogHelper.debug("joinServer: %s accessToken: %s serverID: %s", username, accessToken, serverID);
|
||||||
} catch (AuthException e) {
|
} catch (AuthException e) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent(e.getMessage()));
|
sendError(e.getMessage());
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Internal authHandler error"));
|
sendError("Internal authHandler error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, new JoinServerRequestEvent(success));
|
sendResult(new JoinServerRequestEvent(success));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,21 +8,22 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ProfilesResponse implements JsonResponseInterface {
|
public class ProfilesResponse extends SimpleResponse {
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "profiles";
|
return "profiles";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
if (!client.checkSign && !client.isAuth) {
|
if (!client.checkSign && !client.isAuth) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, new ProfilesRequestEvent((List<ClientProfile>) LaunchServer.server.getProfiles()));
|
sendResult(new ProfilesRequestEvent(LaunchServer.server.getProfiles()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
import ru.gravit.launchserver.websocket.WebSocketFrameHandler;
|
import ru.gravit.launchserver.websocket.WebSocketFrameHandler;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
public class RestoreSessionResponse implements JsonResponseInterface {
|
public class RestoreSessionResponse extends SimpleResponse {
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public long session;
|
public long session;
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,14 +20,14 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
Client rClient = LaunchServer.server.sessionManager.getClient(session);
|
Client rClient = LaunchServer.server.sessionManager.getClient(session);
|
||||||
if(rClient == null)
|
if(rClient == null)
|
||||||
{
|
{
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Session invalid"));
|
sendError("Session invalid");
|
||||||
}
|
}
|
||||||
WebSocketFrameHandler frameHandler = ctx.pipeline().get(WebSocketFrameHandler.class);
|
WebSocketFrameHandler frameHandler = ctx.pipeline().get(WebSocketFrameHandler.class);
|
||||||
frameHandler.setClient(rClient);
|
frameHandler.setClient(rClient);
|
||||||
service.sendObject(ctx, new RestoreSessionRequestEvent());
|
sendResult(new RestoreSessionRequestEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class SetProfileResponse implements JsonResponseInterface {
|
public class SetProfileResponse extends SimpleResponse {
|
||||||
public String client;
|
public String client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,23 +21,23 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
if (!client.isAuth) {
|
if (!client.isAuth) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Collection<ClientProfile> profiles = LaunchServer.server.getProfiles();
|
Collection<ClientProfile> profiles = LaunchServer.server.getProfiles();
|
||||||
for (ClientProfile p : profiles) {
|
for (ClientProfile p : profiles) {
|
||||||
if (p.getTitle().equals(this.client)) {
|
if (p.getTitle().equals(this.client)) {
|
||||||
if (!p.isWhitelistContains(client.username)) {
|
if (!p.isWhitelistContains(client.username)) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent(LaunchServer.server.config.whitelistRejectString));
|
sendError(LaunchServer.server.config.whitelistRejectString);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.profile = p;
|
client.profile = p;
|
||||||
service.sendObject(ctx, new SetProfileRequestEvent(p));
|
sendResult(new SetProfileRequestEvent(p));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Profile not found"));
|
sendError("Profile not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BatchProfileByUsername implements JsonResponseInterface {
|
public class BatchProfileByUsername extends SimpleResponse {
|
||||||
class Entry {
|
class Entry {
|
||||||
String username;
|
String username;
|
||||||
String client;
|
String client;
|
||||||
|
@ -25,7 +26,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
BatchProfileByUsernameRequestEvent result = new BatchProfileByUsernameRequestEvent();
|
BatchProfileByUsernameRequestEvent result = new BatchProfileByUsernameRequestEvent();
|
||||||
result.playerProfiles = new PlayerProfile[list.length];
|
result.playerProfiles = new PlayerProfile[list.length];
|
||||||
for (int i = 0; i < list.length; ++i) {
|
for (int i = 0; i < list.length; ++i) {
|
||||||
|
@ -38,6 +39,6 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
else uuid = client.auth.handler.usernameToUUID(list[i].username);
|
else uuid = client.auth.handler.usernameToUUID(list[i].username);
|
||||||
result.playerProfiles[i] = ProfileByUUIDResponse.getProfile(LaunchServer.server, uuid, list[i].username, list[i].client, client.auth.textureProvider);
|
result.playerProfiles[i] = ProfileByUUIDResponse.getProfile(LaunchServer.server, uuid, list[i].username, list[i].client, client.auth.textureProvider);
|
||||||
}
|
}
|
||||||
service.sendObject(ctx, result);
|
sendResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
import ru.gravit.launchserver.auth.texture.TextureProvider;
|
import ru.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ProfileByUUIDResponse implements JsonResponseInterface {
|
public class ProfileByUUIDResponse extends SimpleResponse {
|
||||||
public UUID uuid;
|
public UUID uuid;
|
||||||
public String client;
|
public String client;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
String username;
|
String username;
|
||||||
if(client.auth == null)
|
if(client.auth == null)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +56,6 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
username = LaunchServer.server.config.getAuthProviderPair().handler.uuidToUsername(uuid);
|
username = LaunchServer.server.config.getAuthProviderPair().handler.uuidToUsername(uuid);
|
||||||
}
|
}
|
||||||
else username = client.auth.handler.uuidToUsername(uuid);
|
else username = client.auth.handler.uuidToUsername(uuid);
|
||||||
service.sendObject(ctx, new ProfileByUUIDRequestEvent(getProfile(LaunchServer.server, uuid, username, this.client, client.auth.textureProvider)));
|
sendResult(new ProfileByUUIDRequestEvent(getProfile(LaunchServer.server, uuid, username, this.client, client.auth.textureProvider)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse.getProfile;
|
import static ru.gravit.launchserver.websocket.json.profile.ProfileByUUIDResponse.getProfile;
|
||||||
|
|
||||||
public class ProfileByUsername implements JsonResponseInterface {
|
public class ProfileByUsername extends SimpleResponse {
|
||||||
String username;
|
String username;
|
||||||
String client;
|
String client;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
if(client.auth == null)
|
if(client.auth == null)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,6 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
uuid = LaunchServer.server.config.getAuthProviderPair().handler.usernameToUUID(username);
|
uuid = LaunchServer.server.config.getAuthProviderPair().handler.usernameToUUID(username);
|
||||||
}
|
}
|
||||||
else uuid = client.auth.handler.usernameToUUID(username);
|
else uuid = client.auth.handler.usernameToUUID(username);
|
||||||
service.sendObject(ctx, new ProfileByUsernameRequestEvent(getProfile(LaunchServer.server, uuid, username, this.client, client.auth.textureProvider)));
|
sendResult(new ProfileByUsernameRequestEvent(getProfile(LaunchServer.server, uuid, username, this.client, client.auth.textureProvider)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,18 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
public class GetSecureTokenResponse implements JsonResponseInterface {
|
public class GetSecureTokenResponse extends SimpleResponse {
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "getSecureToken";
|
return "getSecureToken";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
String secureToken = LaunchServer.server.config.protectHandler.generateClientSecureToken();
|
String secureToken = LaunchServer.server.config.protectHandler.generateClientSecureToken();
|
||||||
client.verifyToken = secureToken;
|
client.verifyToken = secureToken;
|
||||||
service.sendObject(ctx, new GetSecureTokenRequestEvent(secureToken));
|
sendResult(new GetSecureTokenRequestEvent(secureToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
public class VerifySecureTokenResponse implements JsonResponseInterface {
|
public class VerifySecureTokenResponse extends SimpleResponse {
|
||||||
public String secureToken;
|
public String secureToken;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,9 +17,9 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
boolean success = LaunchServer.server.config.protectHandler.verifyClientSecureToken(secureToken, client.verifyToken);
|
boolean success = LaunchServer.server.config.protectHandler.verifyClientSecureToken(secureToken, client.verifyToken);
|
||||||
if(success) client.isSecure = true;
|
if(success) client.isSecure = true;
|
||||||
service.sendObject(ctx, new VerifySecureTokenRequestEvent(success));
|
sendResult(new VerifySecureTokenRequestEvent(success));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
import ru.gravit.utils.Version;
|
import ru.gravit.utils.Version;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
public class LauncherResponse implements JsonResponseInterface {
|
public class LauncherResponse extends SimpleResponse {
|
||||||
public Version version;
|
public Version version;
|
||||||
public String hash;
|
public String hash;
|
||||||
public byte[] digest;
|
public byte[] digest;
|
||||||
|
@ -27,7 +28,7 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
if (hash != null)
|
if (hash != null)
|
||||||
bytes = Base64.getDecoder().decode(hash);
|
bytes = Base64.getDecoder().decode(hash);
|
||||||
|
@ -49,11 +50,11 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
if (hash == null) service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, EXE_URL));
|
if (hash == null) service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, EXE_URL));
|
||||||
if (Arrays.equals(bytes, hash)) {
|
if (Arrays.equals(bytes, hash)) {
|
||||||
client.checkSign = true;
|
client.checkSign = true;
|
||||||
service.sendObject(ctx, new LauncherRequestEvent(false, EXE_URL));
|
sendResult(new LauncherRequestEvent(false, EXE_URL));
|
||||||
} else {
|
} else {
|
||||||
service.sendObjectAndClose(ctx, new LauncherRequestEvent(true, EXE_URL));
|
sendResultAndClose(new LauncherRequestEvent(true, EXE_URL));
|
||||||
}
|
}
|
||||||
} else service.sendObject(ctx, new ErrorRequestEvent("Request launcher type error"));
|
} else sendError("Request launcher type error");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,12 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class UpdateListResponse implements JsonResponseInterface {
|
public class UpdateListResponse extends SimpleResponse {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
|
@ -21,15 +22,15 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
if (!client.isAuth) {
|
if (!client.isAuth) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashSet<String> set = new HashSet<>();
|
HashSet<String> set = new HashSet<>();
|
||||||
for (Map.Entry<String, SignedObjectHolder<HashedDir>> entry : LaunchServer.server.updatesDirMap.entrySet())
|
for (Map.Entry<String, SignedObjectHolder<HashedDir>> entry : LaunchServer.server.updatesDirMap.entrySet())
|
||||||
set.add(entry.getKey());
|
set.add(entry.getKey());
|
||||||
service.sendObject(ctx, new UpdateListRequestEvent(set));
|
sendResult(new UpdateListRequestEvent(set));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.launchserver.websocket.WebSocketService;
|
import ru.gravit.launchserver.websocket.WebSocketService;
|
||||||
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.websocket.json.JsonResponseInterface;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
|
||||||
public class UpdateResponse implements JsonResponseInterface {
|
public class UpdateResponse extends SimpleResponse {
|
||||||
public String dirName;
|
public String dirName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,9 +21,9 @@ public String getType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
if (!client.isAuth || client.type != Client.Type.USER || client.profile == null) {
|
if (!client.isAuth || client.type != Client.Type.USER || client.profile == null) {
|
||||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!client.permissions.canAdmin) {
|
if (!client.permissions.canAdmin) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package ru.gravit.launcher.events;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public abstract class RequestEvent implements ResultInterface {
|
||||||
|
public UUID requestUUID;
|
||||||
|
}
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
import ru.gravit.launcher.ClientPermissions;
|
import ru.gravit.launcher.ClientPermissions;
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AuthRequestEvent implements EventInterface, ResultInterface {
|
public class AuthRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("77e1bfd7-adf9-4f5d-87d6-a7dd068deb74");
|
private static final UUID uuid = UUID.fromString("77e1bfd7-adf9-4f5d-87d6-a7dd068deb74");
|
||||||
|
|
||||||
public AuthRequestEvent() {
|
public AuthRequestEvent() {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BatchProfileByUsernameRequestEvent implements EventInterface, ResultInterface {
|
public class BatchProfileByUsernameRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
|
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String error;
|
public String error;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class CheckServerRequestEvent implements EventInterface, ResultInterface {
|
public class CheckServerRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID _uuid = UUID.fromString("8801d07c-51ba-4059-b61d-fe1f1510b28a");
|
private static final UUID _uuid = UUID.fromString("8801d07c-51ba-4059-b61d-fe1f1510b28a");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public UUID uuid;
|
public UUID uuid;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class EchoRequestEvent implements ResultInterface, EventInterface {
|
public class EchoRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("0a1f820f-7cd5-47a5-ae0e-17492e0e1fe1");
|
private static final UUID uuid = UUID.fromString("0a1f820f-7cd5-47a5-ae0e-17492e0e1fe1");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String echo;
|
public String echo;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ErrorRequestEvent implements ResultInterface, EventInterface {
|
public class ErrorRequestEvent extends RequestEvent implements EventInterface {
|
||||||
public static UUID uuid = UUID.fromString("0af22bc7-aa01-4881-bdbb-dc62b3cdac96");
|
public static UUID uuid = UUID.fromString("0af22bc7-aa01-4881-bdbb-dc62b3cdac96");
|
||||||
|
|
||||||
public ErrorRequestEvent(String error) {
|
public ErrorRequestEvent(String error) {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
public class ExecCommandRequestEvent implements ResultInterface {
|
public class ExecCommandRequestEvent extends RequestEvent {
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "cmdExec";
|
return "cmdExec";
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GetAvailabilityAuthRequestEvent implements ResultInterface {
|
public class GetAvailabilityAuthRequestEvent extends RequestEvent {
|
||||||
public static class AuthAvailability
|
public static class AuthAvailability
|
||||||
{
|
{
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
public class GetSecureTokenRequestEvent implements ResultInterface {
|
public class GetSecureTokenRequestEvent extends RequestEvent {
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String secureToken;
|
public String secureToken;
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class JoinServerRequestEvent implements EventInterface, ResultInterface {
|
public class JoinServerRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("2a12e7b5-3f4a-4891-a2f9-ea141c8e1995");
|
private static final UUID uuid = UUID.fromString("2a12e7b5-3f4a-4891-a2f9-ea141c8e1995");
|
||||||
|
|
||||||
public JoinServerRequestEvent(boolean allow) {
|
public JoinServerRequestEvent(boolean allow) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class LauncherRequestEvent implements EventInterface, ResultInterface {
|
public class LauncherRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("d54cc12a-4f59-4f23-9b10-f527fdd2e38f");
|
private static final UUID uuid = UUID.fromString("d54cc12a-4f59-4f23-9b10-f527fdd2e38f");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String url;
|
public String url;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface {
|
public class ProfileByUUIDRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
|
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String error;
|
public String error;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface {
|
public class ProfileByUsernameRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
|
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public String error;
|
public String error;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
@ -8,7 +9,7 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ProfilesRequestEvent implements EventInterface, ResultInterface {
|
public class ProfilesRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
|
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public List<ClientProfile> profiles;
|
public List<ClientProfile> profiles;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
|
|
||||||
public class RestoreSessionRequestEvent implements ResultInterface {
|
public class RestoreSessionRequestEvent extends RequestEvent {
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "restoreSession";
|
return "restoreSession";
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SetProfileRequestEvent implements ResultInterface, EventInterface {
|
public class SetProfileRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("08c0de9e-4364-4152-9066-8354a3a48541");
|
private static final UUID uuid = UUID.fromString("08c0de9e-4364-4152-9066-8354a3a48541");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public ClientProfile newProfile;
|
public ClientProfile newProfile;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.utils.event.EventInterface;
|
import ru.gravit.utils.event.EventInterface;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UpdateListRequestEvent implements EventInterface, ResultInterface {
|
public class UpdateListRequestEvent extends RequestEvent implements EventInterface {
|
||||||
private static final UUID uuid = UUID.fromString("5fa836ae-6b61-401c-96ac-d8396f07ec6b");
|
private static final UUID uuid = UUID.fromString("5fa836ae-6b61-401c-96ac-d8396f07ec6b");
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public final HashSet<String> dirs;
|
public final HashSet<String> dirs;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherNetworkAPI;
|
import ru.gravit.launcher.LauncherNetworkAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
public class UpdateRequestEvent implements ResultInterface {
|
public class UpdateRequestEvent extends RequestEvent {
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public HashedDir hdir;
|
public HashedDir hdir;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package ru.gravit.launcher.events.request;
|
package ru.gravit.launcher.events.request;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
import ru.gravit.launcher.events.RequestEvent;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
|
||||||
public class VerifySecureTokenRequestEvent implements ResultInterface {
|
public class VerifySecureTokenRequestEvent extends RequestEvent {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public boolean success;
|
public boolean success;
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue