Переименование lastSign в lastDigest

This commit is contained in:
Gravit 2018-10-26 21:49:36 +07:00
parent 23f67c2160
commit d2faeec55f
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 12 additions and 14 deletions

View file

@ -146,7 +146,7 @@ function verifyLauncher(e) {
LauncherRequest.update(Launcher.getConfig(), result);
return;
}
settings.lastSign = result.digest;
settings.lastDigest = result.digest;
processing.resetOverlay();
// Init offline if set
if (settings.offline) {
@ -202,7 +202,7 @@ function doUpdate(profile, pp, accessToken) {
function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) {
processing.resetOverlay();
overlay.swap(0, processing.overlay, function(event)
launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastSign,
launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastDigest,
assetDir, clientDir, pp, accessToken, settings.autoEnter, settings.fullScreen, settings.ram, 0, 0), doDebugClient)
);
}

View file

@ -12,7 +12,7 @@ var settingsClass = Java.extend(LauncherSettingsClass.static, {
settings.setRAM(config.ramDefault);
// Offline cache
settings.lastSign = null;
settings.lastDigest = null;
settings.lastProfiles.clear();
settings.lastHDirs.clear();

View file

@ -1,13 +1,11 @@
package ru.gravit.launcher.client;
import ru.gravit.launcher.Launcher;
import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.hasher.FileNameMatcher;
import ru.gravit.launcher.hasher.HashedDir;
import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
import ru.gravit.utils.helper.SecurityHelper;
import java.io.IOException;
import java.nio.file.Path;
@ -30,17 +28,17 @@ public HashedDirRunnable offlineUpdateRequest(String dirName, Path dir, SignedOb
}
@LauncherAPI
public LegacyLauncherRequest.Result offlineLauncherRequest() throws IOException, SignatureException {
if (settings.lastSign == null || settings.lastProfiles.isEmpty()) {
if (settings.lastDigest == null || settings.lastProfiles.isEmpty()) {
Request.requestError("Запуск в оффлайн-режиме невозможен");
}
// Verify launcher signature
//TODO: TO DIGEST
//SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH,
// settings.lastSign, Launcher.getConfig().publicKey);
// settings.lastDigest, Launcher.getConfig().publicKey);
// Return last sign and profiles
return new LegacyLauncherRequest.Result(null,settings.lastSign,settings.lastProfiles);
return new LegacyLauncherRequest.Result(null,settings.lastDigest,settings.lastProfiles);
}
@FunctionalInterface
public interface HashedDirRunnable {

View file

@ -42,7 +42,7 @@ public class LauncherSettings {
public int ram;
@LauncherAPI
public byte[] lastSign;
public byte[] lastDigest;
@LauncherAPI
public List<SignedObjectHolder<ClientProfile>> lastProfiles = new LinkedList<>();
@LauncherAPI
@ -100,7 +100,7 @@ public void read(HInput input) throws IOException, SignatureException
// Offline cache
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
lastSign = input.readBoolean() ? input.readByteArray(0) : null;
lastDigest = input.readBoolean() ? input.readByteArray(0) : null;
lastProfiles.clear();
int lastProfilesCount = input.readLength(0);
for (int i = 0; i < lastProfilesCount; i++) {
@ -139,9 +139,9 @@ public void write(HOutput output) throws IOException {
output.writeLength(ram, JVMHelper.RAM);
// Offline cache
output.writeBoolean(lastSign != null);
if (lastSign != null) {
output.writeByteArray(lastSign, 0);
output.writeBoolean(lastDigest != null);
if (lastDigest != null) {
output.writeByteArray(lastDigest, 0);
}
output.writeLength(lastProfiles.size(), 0);
for (SignedObjectHolder<ClientProfile> profile : lastProfiles) {
@ -175,7 +175,7 @@ public void setDefault()
//==========
// Offline cache
lastSign = null;
lastDigest = null;
lastProfiles.clear();
lastHDirs.clear();
}