mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
Фикс LauncherResponse
This commit is contained in:
parent
fb7ac48962
commit
e8126f565d
2 changed files with 8 additions and 4 deletions
|
@ -53,7 +53,7 @@ public final byte[] getHash() {
|
||||||
public final boolean sync() throws IOException {
|
public final boolean sync() throws IOException {
|
||||||
boolean exists = exists();
|
boolean exists = exists();
|
||||||
binary = exists ? new SignedBytesHolder(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
binary = exists ? new SignedBytesHolder(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
||||||
hash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA512,IOHelper.newInput(syncBinaryFile));
|
hash = exists ? SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA512,IOHelper.newInput(syncBinaryFile)) : null;
|
||||||
return exists;
|
return exists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,16 +24,20 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
byte[] bytes = Base64.getDecoder().decode(hash);
|
byte[] bytes = Base64.getDecoder().decode(hash);
|
||||||
if(launcher_type == 1) // JAR
|
if(launcher_type == 1) // JAR
|
||||||
{
|
{
|
||||||
if(Arrays.equals(bytes, LaunchServer.server.launcherBinary.getHash())) //REPLACE REAL HASH
|
byte[] hash = LaunchServer.server.launcherBinary.getHash();
|
||||||
|
if(hash == null) service.sendObjectAndClose(ctx, new Result(true));
|
||||||
|
if(Arrays.equals(bytes, hash)) //REPLACE REAL HASH
|
||||||
{
|
{
|
||||||
service.sendObject(ctx, new Result(false));
|
service.sendObject(ctx, new Result(false));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
service.sendObjectAndClose(ctx, new Result(true));
|
service.sendObjectAndClose(ctx, new Result(true));
|
||||||
}
|
}
|
||||||
} else if(launcher_type == 2)
|
} else if(launcher_type == 2) //EXE
|
||||||
{
|
{
|
||||||
if(Arrays.equals(bytes, LaunchServer.server.launcherEXEBinary.getHash())) //REPLACE REAL HASH
|
byte[] hash = LaunchServer.server.launcherEXEBinary.getHash();
|
||||||
|
if(hash == null) service.sendObjectAndClose(ctx, new Result(true));
|
||||||
|
if(Arrays.equals(bytes, hash)) //REPLACE REAL HASH
|
||||||
{
|
{
|
||||||
service.sendObject(ctx, new Result(false));
|
service.sendObject(ctx, new Result(false));
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue