Runtime не контролирует процедуру обновления

This commit is contained in:
Gravit 2018-10-26 23:48:42 +07:00
parent 9f0447dc62
commit 8594c2f702
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 2 additions and 13 deletions

View file

@ -142,10 +142,6 @@ function goSettings(event) {
function verifyLauncher(e) { function verifyLauncher(e) {
processing.resetOverlay(); processing.resetOverlay();
overlay.show(processing.overlay, function(event) makeLauncherRequest(function(result) { overlay.show(processing.overlay, function(event) makeLauncherRequest(function(result) {
if (result.binary !== null) {
LauncherRequest.update(Launcher.getConfig(), result);
return;
}
settings.lastDigest = result.digest; settings.lastDigest = result.digest;
processing.resetOverlay(); processing.resetOverlay();
// Init offline if set // Init offline if set

View file

@ -88,10 +88,8 @@ public Integer getType() {
@Override @Override
@SuppressWarnings("CallToSystemExit") @SuppressWarnings("CallToSystemExit")
protected Result requestDo(HInput input, HOutput output) throws Exception { protected Result requestDo(HInput input, HOutput output) throws Exception {
RSAPublicKey publicKey = config.publicKey;
Path launcherPath = IOHelper.getCodeSource(LauncherRequest.class); Path launcherPath = IOHelper.getCodeSource(LauncherRequest.class);
byte[] digest = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA512,launcherPath); byte[] digest = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA512,launcherPath);
byte[] sign;
output.writeBoolean(EXE_BINARY); output.writeBoolean(EXE_BINARY);
output.writeByteArray(digest,0); output.writeByteArray(digest,0);
output.flush(); output.flush();
@ -101,7 +99,8 @@ protected Result requestDo(HInput input, HOutput output) throws Exception {
boolean shouldUpdate = input.readBoolean(); boolean shouldUpdate = input.readBoolean();
if (shouldUpdate) { if (shouldUpdate) {
byte[] binary = input.readByteArray(0); byte[] binary = input.readByteArray(0);
return new Result(binary, digest); Result result = new Result(binary, digest);
update(Launcher.getConfig(),result);
} }
// Return request result // Return request result

View file

@ -89,15 +89,9 @@ public static void setConfig(LauncherConfig cfg)
@LauncherAPI @LauncherAPI
public static URL getResourceURL(String name) throws IOException { public static URL getResourceURL(String name) throws IOException {
LauncherConfig config = getConfig();
byte[] validDigest = config.runtime.get(name);
if (validDigest == null)
throw new NoSuchFileException(name);
// Resolve URL and verify digest // Resolve URL and verify digest
URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name); URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name);
if (!Arrays.equals(validDigest, SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, url)))
throw new NoSuchFileException(name); // Digest mismatch
// Return verified URL // Return verified URL
return url; return url;