Переименование 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); LauncherRequest.update(Launcher.getConfig(), result);
return; return;
} }
settings.lastSign = result.digest; settings.lastDigest = result.digest;
processing.resetOverlay(); processing.resetOverlay();
// Init offline if set // Init offline if set
if (settings.offline) { if (settings.offline) {
@ -202,7 +202,7 @@ function doUpdate(profile, pp, accessToken) {
function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) { function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) {
processing.resetOverlay(); processing.resetOverlay();
overlay.swap(0, processing.overlay, function(event) 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) 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); settings.setRAM(config.ramDefault);
// Offline cache // Offline cache
settings.lastSign = null; settings.lastDigest = null;
settings.lastProfiles.clear(); settings.lastProfiles.clear();
settings.lastHDirs.clear(); settings.lastHDirs.clear();

View file

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

View file

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