@capgo/capacitor-updater 7.0.25 → 7.0.27
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.
- package/CapgoCapacitorUpdater.podspec +2 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +4 -19
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.ios.deployment_target = '14.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
|
|
@@ -57,7 +57,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
57
57
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
58
58
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
59
59
|
|
|
60
|
-
private final String PLUGIN_VERSION = "7.0.
|
|
60
|
+
private final String PLUGIN_VERSION = "7.0.27";
|
|
61
61
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
62
62
|
|
|
63
63
|
private SharedPreferences.Editor editor;
|
|
@@ -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();
|
|
@@ -365,14 +365,7 @@ public class DownloadService extends Worker {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
private void downloadAndVerify(
|
|
369
|
-
String downloadUrl,
|
|
370
|
-
File targetFile,
|
|
371
|
-
File cacheFile,
|
|
372
|
-
String expectedHash,
|
|
373
|
-
String sessionKey,
|
|
374
|
-
String publicKey
|
|
375
|
-
) throws Exception {
|
|
368
|
+
private void downloadAndVerify(String downloadUrl, File targetFile, File cacheFile, String expectedHash) throws Exception {
|
|
376
369
|
Log.d(TAG, "downloadAndVerify " + downloadUrl);
|
|
377
370
|
|
|
378
371
|
Request request = new Request.Builder().url(downloadUrl).build();
|
|
@@ -400,14 +393,6 @@ public class DownloadService extends Worker {
|
|
|
400
393
|
}
|
|
401
394
|
}
|
|
402
395
|
|
|
403
|
-
String decryptedExpectedHash = expectedHash;
|
|
404
|
-
|
|
405
|
-
if (!publicKey.isEmpty() && sessionKey != null && !sessionKey.isEmpty()) {
|
|
406
|
-
Log.d(CapacitorUpdater.TAG + " DLSrv", "Decrypting file " + targetFile.getName());
|
|
407
|
-
CryptoCipherV2.decryptFile(compressedFile, publicKey, sessionKey);
|
|
408
|
-
decryptedExpectedHash = CryptoCipherV2.decryptChecksum(decryptedExpectedHash, publicKey);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
396
|
// Use new decompression method
|
|
412
397
|
byte[] compressedData = Files.readAllBytes(compressedFile.toPath());
|
|
413
398
|
byte[] decompressedData = decompressBrotli(compressedData, targetFile.getName());
|
|
@@ -418,7 +403,7 @@ public class DownloadService extends Worker {
|
|
|
418
403
|
String calculatedHash = CryptoCipherV2.calcChecksum(targetFile);
|
|
419
404
|
|
|
420
405
|
// Verify checksum
|
|
421
|
-
if (calculatedHash.equals(
|
|
406
|
+
if (calculatedHash.equals(expectedHash)) {
|
|
422
407
|
// Only cache if checksum is correct
|
|
423
408
|
copyFile(targetFile, cacheFile);
|
|
424
409
|
} else {
|
|
@@ -429,7 +414,7 @@ public class DownloadService extends Worker {
|
|
|
429
414
|
" " +
|
|
430
415
|
targetFile.getName() +
|
|
431
416
|
" expected: " +
|
|
432
|
-
|
|
417
|
+
expectedHash +
|
|
433
418
|
" calculated: " +
|
|
434
419
|
calculatedHash
|
|
435
420
|
);
|
|
@@ -45,7 +45,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
45
45
|
CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise)
|
|
46
46
|
]
|
|
47
47
|
public var implementation = CapacitorUpdater()
|
|
48
|
-
private let PLUGIN_VERSION: String = "7.0.
|
|
48
|
+
private let PLUGIN_VERSION: String = "7.0.27"
|
|
49
49
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
50
50
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
51
51
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|