[FIX] Фикс авторизации сервера и проверки лаунчера

This commit is contained in:
Gravit 2019-01-28 20:56:20 +07:00
parent 9ea4c051d5
commit 2937d70866
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 8 additions and 1 deletions

View file

@ -35,7 +35,12 @@ public AuthResponse(String login, String password, int authid, OshiHWID hwid) {
} }
public int authid; public int authid;
public ConnectTypes type;
public OshiHWID hwid; public OshiHWID hwid;
enum ConnectTypes
{
SERVER,CLIENT
}
@Override @Override
public String getType() { public String getType() {
@ -51,7 +56,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
AuthProvider.authError(LaunchServer.server.config.authRejectString); AuthProvider.authError(LaunchServer.server.config.authRejectString);
return; return;
} }
if (!clientData.checkSign) { if (type == ConnectTypes.SERVER &&!clientData.checkSign) {
AuthProvider.authError("Don't skip Launcher Update"); AuthProvider.authError("Don't skip Launcher Update");
return; return;
} }

View file

@ -31,6 +31,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
byte[] hash = LaunchServer.server.launcherBinary.getBytes().getDigest(); byte[] hash = LaunchServer.server.launcherBinary.getBytes().getDigest();
if (hash == null) service.sendObjectAndClose(ctx, new Result(true, JAR_URL)); if (hash == null) service.sendObjectAndClose(ctx, new Result(true, JAR_URL));
if (Arrays.equals(bytes, hash)) { if (Arrays.equals(bytes, hash)) {
client.checkSign = true;
service.sendObject(ctx, new Result(false, JAR_URL)); service.sendObject(ctx, new Result(false, JAR_URL));
} else { } else {
service.sendObjectAndClose(ctx, new Result(true, JAR_URL)); service.sendObjectAndClose(ctx, new Result(true, JAR_URL));
@ -40,6 +41,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
byte[] hash = LaunchServer.server.launcherEXEBinary.getBytes().getDigest(); byte[] hash = LaunchServer.server.launcherEXEBinary.getBytes().getDigest();
if (hash == null) service.sendObjectAndClose(ctx, new Result(true, EXE_URL)); if (hash == null) service.sendObjectAndClose(ctx, new Result(true, EXE_URL));
if (Arrays.equals(bytes, hash)) { if (Arrays.equals(bytes, hash)) {
client.checkSign = true;
service.sendObject(ctx, new Result(false, EXE_URL)); service.sendObject(ctx, new Result(false, EXE_URL));
} else { } else {
service.sendObjectAndClose(ctx, new Result(true, EXE_URL)); service.sendObjectAndClose(ctx, new Result(true, EXE_URL));