mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Фиксы AddLogListener/ExecCommand/Auth
This commit is contained in:
parent
b3d007c6d1
commit
ef1f7b0e76
5 changed files with 21 additions and 14 deletions
|
@ -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() {
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue