@capgo/capacitor-updater 5.3.45 → 5.3.46
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.
|
@@ -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.
|
|
58
|
+
private final String PLUGIN_VERSION = "5.3.46";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -332,9 +332,27 @@ extension CustomError: LocalizedError {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
private func getChecksum(filePath: URL) -> String {
|
|
335
|
+
let bufferSize = 1024 * 1024 * 5 // 5 MB
|
|
336
|
+
var checksum = uLong(0)
|
|
337
|
+
|
|
335
338
|
do {
|
|
336
|
-
let
|
|
337
|
-
|
|
339
|
+
let fileHandle = try FileHandle(forReadingFrom: filePath)
|
|
340
|
+
defer {
|
|
341
|
+
fileHandle.closeFile()
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
while autoreleasepool(invoking: {
|
|
345
|
+
let fileData = fileHandle.readData(ofLength: bufferSize)
|
|
346
|
+
if fileData.count > 0 {
|
|
347
|
+
checksum = fileData.withUnsafeBytes {
|
|
348
|
+
crc32(checksum, $0.bindMemory(to: Bytef.self).baseAddress, uInt(fileData.count))
|
|
349
|
+
}
|
|
350
|
+
return true // Continue
|
|
351
|
+
} else {
|
|
352
|
+
return false // End of file
|
|
353
|
+
}
|
|
354
|
+
}) {}
|
|
355
|
+
|
|
338
356
|
return String(format: "%08X", checksum).lowercased()
|
|
339
357
|
} catch {
|
|
340
358
|
print("\(self.TAG) Cannot get checksum: \(filePath.path)", error)
|
|
@@ -342,6 +360,8 @@ extension CustomError: LocalizedError {
|
|
|
342
360
|
}
|
|
343
361
|
}
|
|
344
362
|
|
|
363
|
+
|
|
364
|
+
|
|
345
365
|
private func decryptFile(filePath: URL, sessionKey: String, version: String) throws {
|
|
346
366
|
if self.privateKey.isEmpty || sessionKey.isEmpty || sessionKey.components(separatedBy: ":").count != 2 {
|
|
347
367
|
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.
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.3.46"
|
|
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"
|