@capgo/capacitor-updater 6.14.13 → 6.14.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.dependency 'SSZipArchive', '2.4.3'
|
|
17
|
-
s.dependency 'Alamofire'
|
|
18
|
-
s.dependency 'Version'
|
|
17
|
+
s.dependency 'Alamofire', '5.10.2'
|
|
18
|
+
s.dependency 'Version', '0.8.0'
|
|
19
19
|
s.swift_version = '5.1'
|
|
20
20
|
end
|
package/Package.swift
CHANGED
|
@@ -12,7 +12,7 @@ let package = Package(
|
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),
|
|
14
14
|
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.2")),
|
|
15
|
-
.package(url: "https://github.com/ZipArchive/ZipArchive.git", exact: "2.
|
|
15
|
+
.package(url: "https://github.com/ZipArchive/ZipArchive.git", exact: "2.4.3"),
|
|
16
16
|
.package(url: "https://github.com/mrackwitz/Version.git", .upToNextMajor(from: "0.8.0"))
|
|
17
17
|
],
|
|
18
18
|
targets: [
|
|
@@ -194,7 +194,7 @@ public class DownloadService extends Worker {
|
|
|
194
194
|
copyFile(cacheFile, targetFile);
|
|
195
195
|
Log.d(TAG, "already cached " + fileName);
|
|
196
196
|
} else {
|
|
197
|
-
downloadAndVerify(downloadUrl, targetFile, cacheFile, finalFileHash
|
|
197
|
+
downloadAndVerify(downloadUrl, targetFile, cacheFile, finalFileHash);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
long completed = completedFiles.incrementAndGet();
|
|
@@ -229,9 +229,11 @@ public class DownloadService extends Worker {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
if (hasError.get()) {
|
|
232
|
+
Log.e(TAG, "One or more files failed to download");
|
|
232
233
|
throw new IOException("One or more files failed to download");
|
|
233
234
|
}
|
|
234
235
|
} catch (Exception e) {
|
|
236
|
+
Log.e(TAG, "Error in handleManifestDownload", e);
|
|
235
237
|
throw new RuntimeException(e.getLocalizedMessage());
|
|
236
238
|
}
|
|
237
239
|
}
|
|
@@ -363,14 +365,7 @@ public class DownloadService extends Worker {
|
|
|
363
365
|
}
|
|
364
366
|
}
|
|
365
367
|
|
|
366
|
-
private void downloadAndVerify(
|
|
367
|
-
String downloadUrl,
|
|
368
|
-
File targetFile,
|
|
369
|
-
File cacheFile,
|
|
370
|
-
String expectedHash,
|
|
371
|
-
String sessionKey,
|
|
372
|
-
String publicKey
|
|
373
|
-
) throws Exception {
|
|
368
|
+
private void downloadAndVerify(String downloadUrl, File targetFile, File cacheFile, String expectedHash) throws Exception {
|
|
374
369
|
Log.d(TAG, "downloadAndVerify " + downloadUrl);
|
|
375
370
|
|
|
376
371
|
Request request = new Request.Builder().url(downloadUrl).build();
|
|
@@ -398,14 +393,6 @@ public class DownloadService extends Worker {
|
|
|
398
393
|
}
|
|
399
394
|
}
|
|
400
395
|
|
|
401
|
-
String decryptedExpectedHash = expectedHash;
|
|
402
|
-
|
|
403
|
-
if (!publicKey.isEmpty() && sessionKey != null && !sessionKey.isEmpty()) {
|
|
404
|
-
Log.d(CapacitorUpdater.TAG + " DLSrv", "Decrypting file " + targetFile.getName());
|
|
405
|
-
CryptoCipherV2.decryptFile(compressedFile, publicKey, sessionKey);
|
|
406
|
-
decryptedExpectedHash = CryptoCipherV2.decryptChecksum(decryptedExpectedHash, publicKey);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
396
|
// Use new decompression method
|
|
410
397
|
byte[] compressedData = Files.readAllBytes(compressedFile.toPath());
|
|
411
398
|
byte[] decompressedData = decompressBrotli(compressedData, targetFile.getName());
|
|
@@ -416,7 +403,7 @@ public class DownloadService extends Worker {
|
|
|
416
403
|
String calculatedHash = CryptoCipherV2.calcChecksum(targetFile);
|
|
417
404
|
|
|
418
405
|
// Verify checksum
|
|
419
|
-
if (calculatedHash.equals(
|
|
406
|
+
if (calculatedHash.equals(expectedHash)) {
|
|
420
407
|
// Only cache if checksum is correct
|
|
421
408
|
copyFile(targetFile, cacheFile);
|
|
422
409
|
} else {
|
|
@@ -427,7 +414,7 @@ public class DownloadService extends Worker {
|
|
|
427
414
|
" " +
|
|
428
415
|
targetFile.getName() +
|
|
429
416
|
" expected: " +
|
|
430
|
-
|
|
417
|
+
expectedHash +
|
|
431
418
|
" calculated: " +
|
|
432
419
|
calculatedHash
|
|
433
420
|
);
|