@capgo/capacitor-updater 6.0.56 → 6.0.58

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.
@@ -339,7 +339,7 @@ public class CapacitorUpdater {
339
339
  final File downloaded = new File(this.documentsDir, dest);
340
340
  this.decryptFile(downloaded, sessionKey, version);
341
341
  final String checksum;
342
- checksum = this.getChecksum(downloaded);
342
+ checksum = this.calcChecksum(downloaded);
343
343
  this.notifyDownload(id, 71);
344
344
  final File unzipped = this.unzip(id, downloaded, this.randomString());
345
345
  downloaded.delete();
@@ -483,18 +483,23 @@ public class CapacitorUpdater {
483
483
  this.editor.commit();
484
484
  }
485
485
 
486
- private String getChecksum(File file) throws IOException {
486
+ private String calcChecksum(File file) {
487
487
  final int BUFFER_SIZE = 1024 * 1024 * 5; // 5 MB buffer size
488
488
  CRC32 crc = new CRC32();
489
+
489
490
  try (FileInputStream fis = new FileInputStream(file)) {
490
491
  byte[] buffer = new byte[BUFFER_SIZE];
491
492
  int length;
492
493
  while ((length = fis.read(buffer)) != -1) {
493
494
  crc.update(buffer, 0, length);
494
495
  }
496
+ return String.format("%08x", crc.getValue());
497
+ } catch (IOException e) {
498
+ System.err.println(
499
+ TAG + " Cannot calc checksum: " + file.getPath() + " " + e.getMessage()
500
+ );
501
+ return "";
495
502
  }
496
- String enc = String.format("%08X", crc.getValue());
497
- return enc.toLowerCase();
498
503
  }
499
504
 
500
505
  private void decryptFile(
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
55
55
  private static final String channelUrlDefault =
56
56
  "https://api.capgo.app/channel_self";
57
57
 
58
- private final String PLUGIN_VERSION = "6.0.56";
58
+ private final String PLUGIN_VERSION = "6.0.58";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
@@ -335,7 +335,7 @@ extension CustomError: LocalizedError {
335
335
  }
336
336
  }
337
337
 
338
- private func getChecksum(filePath: URL) -> String {
338
+ private func calcChecksum(filePath: URL) -> String {
339
339
  let bufferSize = 1024 * 1024 * 5 // 5 MB
340
340
  var checksum = uLong(0)
341
341
 
@@ -359,7 +359,7 @@ extension CustomError: LocalizedError {
359
359
 
360
360
  return String(format: "%08X", checksum).lowercased()
361
361
  } catch {
362
- print("\(self.TAG) Cannot get checksum: \(filePath.path)", error)
362
+ print("\(self.TAG) Cannot calc checksum: \(filePath.path)", error)
363
363
  return ""
364
364
  }
365
365
  }
@@ -581,7 +581,7 @@ extension CustomError: LocalizedError {
581
581
  self.notifyDownload(id, 71)
582
582
  do {
583
583
  try self.decryptFile(filePath: fileURL, sessionKey: sessionKey, version: version)
584
- checksum = self.getChecksum(filePath: fileURL)
584
+ checksum = self.calcChecksum(filePath: fileURL)
585
585
  try self.saveDownloaded(sourceZip: fileURL, id: id, base: self.libraryDir.appendingPathComponent(self.bundleDirectory), notify: true)
586
586
  try self.deleteFolder(source: fileURL)
587
587
  self.notifyDownload(id, 100)
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  public var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "6.0.56"
18
+ private let PLUGIN_VERSION: String = "6.0.58"
19
19
  static let updateUrlDefault = "https://api.capgo.app/updates"
20
20
  static let statsUrlDefault = "https://api.capgo.app/stats"
21
21
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "6.0.56",
3
+ "version": "6.0.58",
4
4
  "packageManager": "pnpm@8.15.9",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",