mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Runtime не контролирует процедуру обновления
This commit is contained in:
parent
9f0447dc62
commit
8594c2f702
3 changed files with 2 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue