diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java index 3d1150e7..ffebe4cc 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/WebSocketService.java @@ -17,6 +17,7 @@ import ru.gravit.launchserver.socket.websocket.json.JsonResponseAdapter; import ru.gravit.launchserver.socket.websocket.json.JsonResponseInterface; import ru.gravit.launchserver.socket.websocket.json.admin.AddLogListenerResponse; +import ru.gravit.launchserver.socket.websocket.json.admin.ExecCommandResponse; import ru.gravit.launchserver.socket.websocket.json.auth.*; import ru.gravit.launchserver.socket.websocket.json.update.LauncherResponse; import ru.gravit.launchserver.socket.websocket.json.update.UpdateListResponse; @@ -75,7 +76,7 @@ public void registerResponses() { registerResponse("profiles", ProfilesResponse.class); registerResponse("launcher", LauncherResponse.class); registerResponse("updateList", UpdateListResponse.class); - registerResponse("cmdExec", UpdateListResponse.class); + registerResponse("cmdExec", ExecCommandResponse.class); registerResponse("setProfile", SetProfileResponse.class); registerResponse("addLogListener", AddLogListenerResponse.class); } @@ -99,16 +100,6 @@ public void sendEvent(EventResult obj) { channels.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj))); } - public static class SuccessResult { - public SuccessResult(String requesttype) { - this.requesttype = requesttype; - this.type = "success"; - } - - public final String requesttype; - public final String type; - } - public static class EventResult implements ResultInterface { public EventResult() { diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/AddLogListenerResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/AddLogListenerResponse.java index 48b30c7b..9576f484 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/AddLogListenerResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/AddLogListenerResponse.java @@ -38,8 +38,8 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client service.sendObject(ctx,new LogEvent(str)); } else { - LogHelper.info("Client %s remove log listener", client.username); LogHelper.removeOutput(client.logOutput); + LogHelper.info("Client %s remove log listener", client.username); } }; client.logOutput = output; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/ExecCommandResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/ExecCommandResponse.java index 457f3860..c7c0fd9d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/ExecCommandResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/admin/ExecCommandResponse.java @@ -2,6 +2,7 @@ import io.netty.channel.ChannelHandlerContext; import ru.gravit.launcher.events.request.ErrorRequestEvent; +import ru.gravit.launcher.events.request.ExecCommandRequestEvent; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.socket.Client; import ru.gravit.launchserver.socket.websocket.WebSocketService; @@ -26,6 +27,6 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client return; } LaunchServer.server.commandHandler.eval(cmd, false); - service.sendObject(ctx, new WebSocketService.SuccessResult("cmdExec")); + service.sendObject(ctx, new ExecCommandRequestEvent(true)); } } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java index 2c650135..65aae7e9 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/websocket/json/auth/AuthResponse.java @@ -60,7 +60,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client AuthProvider.authError(LaunchServer.server.config.authRejectString); return; } - if (authType != ConnectTypes.CLIENT &&!clientData.checkSign) { + if ((authType == null || authType == ConnectTypes.CLIENT) &&!clientData.checkSign) { AuthProvider.authError("Don't skip Launcher Update"); return; } diff --git a/libLauncher/src/main/java/ru/gravit/launcher/events/request/ExecCommandRequestEvent.java b/libLauncher/src/main/java/ru/gravit/launcher/events/request/ExecCommandRequestEvent.java new file mode 100644 index 00000000..d1eafbf7 --- /dev/null +++ b/libLauncher/src/main/java/ru/gravit/launcher/events/request/ExecCommandRequestEvent.java @@ -0,0 +1,15 @@ +package ru.gravit.launcher.events.request; + +import ru.gravit.launcher.request.ResultInterface; + +public class ExecCommandRequestEvent implements ResultInterface { + @Override + public String getType() { + return "execCmd"; + } + boolean success; + + public ExecCommandRequestEvent(boolean success) { + this.success = success; + } +}