@capgo/capacitor-updater 5.3.46 → 5.3.53

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/README.md CHANGED
@@ -366,6 +366,7 @@ setChannel(options: SetChannelOptions) => Promise<channelRes>
366
366
  ```
367
367
 
368
368
  Set Channel for this device, the channel have to allow self assignement to make this work
369
+ Do not use this method to set the channel at boot when autoUpdate is enabled, this method is made to set the channel after the app is ready when user click on a button for example
369
370
 
370
371
  | Param | Type | Description |
371
372
  | ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
@@ -488,9 +488,10 @@ public class CapacitorUpdater {
488
488
  }
489
489
 
490
490
  private String getChecksum(File file) throws IOException {
491
+ final int BUFFER_SIZE = 1024 * 1024 * 5; // 5 MB buffer size
491
492
  CRC32 crc = new CRC32();
492
493
  try (FileInputStream fis = new FileInputStream(file)) {
493
- byte[] buffer = new byte[1024];
494
+ byte[] buffer = new byte[BUFFER_SIZE];
494
495
  int length;
495
496
  while ((length = fis.read(buffer)) != -1) {
496
497
  crc.update(buffer, 0, length);
@@ -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 = "5.3.46";
58
+ private final String PLUGIN_VERSION = "5.3.53";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
package/dist/docs.json CHANGED
@@ -364,7 +364,7 @@
364
364
  "text": "4.7.0"
365
365
  }
366
366
  ],
367
- "docs": "Set Channel for this device, the channel have to allow self assignement to make this work",
367
+ "docs": "Set Channel for this device, the channel have to allow self assignement to make this work\nDo not use this method to set the channel at boot when autoUpdate is enabled, this method is made to set the channel after the app is ready when user click on a button for example",
368
368
  "complexTypes": [
369
369
  "channelRes",
370
370
  "SetChannelOptions"
@@ -1660,9 +1660,89 @@
1660
1660
  "name": "default"
1661
1661
  }
1662
1662
  ],
1663
- "docs": "Configure the delay period for period update check. the unit is in seconds.\n\nOnly available for Android and iOS.",
1663
+ "docs": "Configure the delay period for period update check. the unit is in seconds.\n\nOnly available for Android and iOS.\nCannot be less than 600 seconds (10 minutes).",
1664
1664
  "complexTypes": [],
1665
1665
  "type": "number | undefined"
1666
+ },
1667
+ {
1668
+ "name": "localS3",
1669
+ "tags": [
1670
+ {
1671
+ "text": "undefined",
1672
+ "name": "default"
1673
+ },
1674
+ {
1675
+ "text": "4.17.48",
1676
+ "name": "since"
1677
+ }
1678
+ ],
1679
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1680
+ "complexTypes": [],
1681
+ "type": "boolean | undefined"
1682
+ },
1683
+ {
1684
+ "name": "localHost",
1685
+ "tags": [
1686
+ {
1687
+ "text": "undefined",
1688
+ "name": "default"
1689
+ },
1690
+ {
1691
+ "text": "4.17.48",
1692
+ "name": "since"
1693
+ }
1694
+ ],
1695
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1696
+ "complexTypes": [],
1697
+ "type": "string | undefined"
1698
+ },
1699
+ {
1700
+ "name": "localWebHost",
1701
+ "tags": [
1702
+ {
1703
+ "text": "undefined",
1704
+ "name": "default"
1705
+ },
1706
+ {
1707
+ "text": "4.17.48",
1708
+ "name": "since"
1709
+ }
1710
+ ],
1711
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1712
+ "complexTypes": [],
1713
+ "type": "string | undefined"
1714
+ },
1715
+ {
1716
+ "name": "localSupa",
1717
+ "tags": [
1718
+ {
1719
+ "text": "undefined",
1720
+ "name": "default"
1721
+ },
1722
+ {
1723
+ "text": "4.17.48",
1724
+ "name": "since"
1725
+ }
1726
+ ],
1727
+ "docs": "Configure the CLI to use a local server for testing or self-hosted update server.",
1728
+ "complexTypes": [],
1729
+ "type": "string | undefined"
1730
+ },
1731
+ {
1732
+ "name": "localSupaAnon",
1733
+ "tags": [
1734
+ {
1735
+ "text": "undefined",
1736
+ "name": "default"
1737
+ },
1738
+ {
1739
+ "text": "4.17.48",
1740
+ "name": "since"
1741
+ }
1742
+ ],
1743
+ "docs": "Configure the CLI to use a local server for testing.",
1744
+ "complexTypes": [],
1745
+ "type": "string | undefined"
1666
1746
  }
1667
1747
  ],
1668
1748
  "docs": "These configuration values are available:"
@@ -108,10 +108,51 @@ declare module "@capacitor/cli" {
108
108
  * Configure the delay period for period update check. the unit is in seconds.
109
109
  *
110
110
  * Only available for Android and iOS.
111
+ * Cannot be less than 600 seconds (10 minutes).
111
112
  *
112
113
  * @default 600 // (10 minutes)
113
114
  */
114
115
  periodCheckDelay?: number;
116
+ /**
117
+ * Configure the CLI to use a local server for testing or self-hosted update server.
118
+ *
119
+ *
120
+ * @default undefined
121
+ * @since 4.17.48
122
+ */
123
+ localS3?: boolean;
124
+ /**
125
+ * Configure the CLI to use a local server for testing or self-hosted update server.
126
+ *
127
+ *
128
+ * @default undefined
129
+ * @since 4.17.48
130
+ */
131
+ localHost?: string;
132
+ /**
133
+ * Configure the CLI to use a local server for testing or self-hosted update server.
134
+ *
135
+ *
136
+ * @default undefined
137
+ * @since 4.17.48
138
+ */
139
+ localWebHost?: string;
140
+ /**
141
+ * Configure the CLI to use a local server for testing or self-hosted update server.
142
+ *
143
+ *
144
+ * @default undefined
145
+ * @since 4.17.48
146
+ */
147
+ localSupa?: string;
148
+ /**
149
+ * Configure the CLI to use a local server for testing.
150
+ *
151
+ *
152
+ * @default undefined
153
+ * @since 4.17.48
154
+ */
155
+ localSupaAnon?: string;
115
156
  };
116
157
  }
117
158
  }
@@ -387,6 +428,7 @@ export interface CapacitorUpdaterPlugin {
387
428
  getLatest(): Promise<latestVersion>;
388
429
  /**
389
430
  * Set Channel for this device, the channel have to allow self assignement to make this work
431
+ * Do not use this method to set the channel at boot when autoUpdate is enabled, this method is made to set the channel after the app is ready when user click on a button for example
390
432
  *
391
433
  * @returns {Promise<channelRes>} an Promise resolved when channel is set
392
434
  * @param options is the {@link SetChannelOptions} channel to set
@@ -334,13 +334,13 @@ extension CustomError: LocalizedError {
334
334
  private func getChecksum(filePath: URL) -> String {
335
335
  let bufferSize = 1024 * 1024 * 5 // 5 MB
336
336
  var checksum = uLong(0)
337
-
337
+
338
338
  do {
339
339
  let fileHandle = try FileHandle(forReadingFrom: filePath)
340
340
  defer {
341
341
  fileHandle.closeFile()
342
342
  }
343
-
343
+
344
344
  while autoreleasepool(invoking: {
345
345
  let fileData = fileHandle.readData(ofLength: bufferSize)
346
346
  if fileData.count > 0 {
@@ -352,7 +352,7 @@ extension CustomError: LocalizedError {
352
352
  return false // End of file
353
353
  }
354
354
  }) {}
355
-
355
+
356
356
  return String(format: "%08X", checksum).lowercased()
357
357
  } catch {
358
358
  print("\(self.TAG) Cannot get checksum: \(filePath.path)", error)
@@ -360,8 +360,6 @@ extension CustomError: LocalizedError {
360
360
  }
361
361
  }
362
362
 
363
-
364
-
365
363
  private func decryptFile(filePath: URL, sessionKey: String, version: String) throws {
366
364
  if self.privateKey.isEmpty || sessionKey.isEmpty || sessionKey.components(separatedBy: ":").count != 2 {
367
365
  print("\(self.TAG) Cannot found privateKey or sessionKey")
@@ -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 = "5.3.46"
18
+ private let PLUGIN_VERSION: String = "5.3.53"
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": "5.3.46",
3
+ "version": "5.3.53",
4
4
  "packageManager": "pnpm@8.14.1",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",