mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-02-02 04:25:27 +03:00
SuccessResult
This commit is contained in:
parent
3daabe584f
commit
df0d9f37a2
2 changed files with 15 additions and 5 deletions
|
@ -32,7 +32,7 @@ public void sendObject(ChannelHandlerContext ctx, Object obj)
|
||||||
{
|
{
|
||||||
ctx.channel().writeAndFlush(new TextWebSocketFrame(gson.toJson(obj)));
|
ctx.channel().writeAndFlush(new TextWebSocketFrame(gson.toJson(obj)));
|
||||||
}
|
}
|
||||||
public class ErrorResult
|
public static class ErrorResult
|
||||||
{
|
{
|
||||||
public ErrorResult(String error) {
|
public ErrorResult(String error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
|
@ -42,6 +42,16 @@ public ErrorResult(String error) {
|
||||||
public final String error;
|
public final String error;
|
||||||
public final String type;
|
public final String type;
|
||||||
}
|
}
|
||||||
|
public static class SuccessResult
|
||||||
|
{
|
||||||
|
public SuccessResult(String requesttype) {
|
||||||
|
this.requesttype = requesttype;
|
||||||
|
this.type = "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String requesttype;
|
||||||
|
public final String type;
|
||||||
|
}
|
||||||
public class ExceptionResult
|
public class ExceptionResult
|
||||||
{
|
{
|
||||||
public ExceptionResult(Exception e) {
|
public ExceptionResult(Exception e) {
|
||||||
|
|
|
@ -67,15 +67,15 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx) throws
|
||||||
// throw new AuthException("You profile not found");
|
// throw new AuthException("You profile not found");
|
||||||
//}
|
//}
|
||||||
server.config.hwidHandler.check(hwid, result.username);
|
server.config.hwidHandler.check(hwid, result.username);
|
||||||
|
service.sendObject(ctx,new WebSocketService.SuccessResult("auth"));
|
||||||
} catch (AuthException | HWIDException e)
|
} catch (AuthException | HWIDException e)
|
||||||
{
|
{
|
||||||
service.sendObject(ctx,new ErrorResult(e.getMessage()));
|
service.sendObject(ctx,new WebSocketService.ErrorResult(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ErrorResult
|
public class Result
|
||||||
{
|
{
|
||||||
public ErrorResult(String error) {
|
public Result() {
|
||||||
this.error = error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String error;
|
public String error;
|
||||||
|
|
Loading…
Reference in a new issue