From 8594c2f702772dfaea3096a4084d4a7d7c889db8 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 26 Oct 2018 23:48:42 +0700 Subject: [PATCH] =?UTF-8?q?Runtime=20=D0=BD=D0=B5=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BB=D0=B8=D1=80=D1=83=D0=B5=D1=82=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83=D1=80=D1=83=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Launcher/runtime/dialog/dialog.js | 4 ---- .../ru/gravit/launcher/request/update/LauncherRequest.java | 5 ++--- libLauncher/src/main/java/ru/gravit/launcher/Launcher.java | 6 ------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Launcher/runtime/dialog/dialog.js b/Launcher/runtime/dialog/dialog.js index 1777eb87..5e8075cf 100644 --- a/Launcher/runtime/dialog/dialog.js +++ b/Launcher/runtime/dialog/dialog.js @@ -142,10 +142,6 @@ function goSettings(event) { function verifyLauncher(e) { processing.resetOverlay(); overlay.show(processing.overlay, function(event) makeLauncherRequest(function(result) { - if (result.binary !== null) { - LauncherRequest.update(Launcher.getConfig(), result); - return; - } settings.lastDigest = result.digest; processing.resetOverlay(); // Init offline if set diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/LauncherRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/LauncherRequest.java index edb6d13f..db25945d 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/LauncherRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/LauncherRequest.java @@ -88,10 +88,8 @@ public Integer getType() { @Override @SuppressWarnings("CallToSystemExit") protected Result requestDo(HInput input, HOutput output) throws Exception { - RSAPublicKey publicKey = config.publicKey; Path launcherPath = IOHelper.getCodeSource(LauncherRequest.class); byte[] digest = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA512,launcherPath); - byte[] sign; output.writeBoolean(EXE_BINARY); output.writeByteArray(digest,0); output.flush(); @@ -101,7 +99,8 @@ protected Result requestDo(HInput input, HOutput output) throws Exception { boolean shouldUpdate = input.readBoolean(); if (shouldUpdate) { byte[] binary = input.readByteArray(0); - return new Result(binary, digest); + Result result = new Result(binary, digest); + update(Launcher.getConfig(),result); } // Return request result diff --git a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java index 35079af5..1fc4b911 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java @@ -89,15 +89,9 @@ public static void setConfig(LauncherConfig cfg) @LauncherAPI 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 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 url;