@capgo/capacitor-updater 4.12.10 → 4.13.2
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 +0 -1
- package/README.md +10 -10
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +194 -134
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +23 -23
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +756 -686
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1108 -831
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +147 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +45 -41
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
- package/dist/docs.json +16 -16
- package/dist/esm/definitions.d.ts +12 -12
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +34 -34
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +34 -34
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +34 -34
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +25 -12
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +4 -2
- package/ios/Plugin/CryptoCipher.swift +264 -0
- package/package.json +2 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/RSACipher.java +0 -51
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,99 +2,99 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
-
const CapacitorUpdater = core.registerPlugin(
|
|
5
|
+
const CapacitorUpdater = core.registerPlugin("CapacitorUpdater", {
|
|
6
6
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorUpdaterWeb()),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
const BUNDLE_BUILTIN = {
|
|
10
|
-
status:
|
|
11
|
-
version:
|
|
12
|
-
downloaded:
|
|
13
|
-
id:
|
|
14
|
-
checksum:
|
|
10
|
+
status: "success",
|
|
11
|
+
version: "",
|
|
12
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
13
|
+
id: "builtin",
|
|
14
|
+
checksum: "",
|
|
15
15
|
};
|
|
16
16
|
class CapacitorUpdaterWeb extends core.WebPlugin {
|
|
17
17
|
async download(options) {
|
|
18
|
-
console.warn(
|
|
18
|
+
console.warn("Cannot download version in web", options);
|
|
19
19
|
return BUNDLE_BUILTIN;
|
|
20
20
|
}
|
|
21
21
|
async next(options) {
|
|
22
|
-
console.warn(
|
|
22
|
+
console.warn("Cannot set next version in web", options);
|
|
23
23
|
return BUNDLE_BUILTIN;
|
|
24
24
|
}
|
|
25
25
|
async isAutoUpdateEnabled() {
|
|
26
|
-
console.warn(
|
|
26
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
27
27
|
return { enabled: false };
|
|
28
28
|
}
|
|
29
29
|
async set(options) {
|
|
30
|
-
console.warn(
|
|
30
|
+
console.warn("Cannot set active bundle in web", options);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
async getDeviceId() {
|
|
34
|
-
console.warn(
|
|
35
|
-
return { deviceId:
|
|
34
|
+
console.warn("Cannot get ID in web");
|
|
35
|
+
return { deviceId: "default" };
|
|
36
36
|
}
|
|
37
37
|
async getPluginVersion() {
|
|
38
|
-
console.warn(
|
|
39
|
-
return { version:
|
|
38
|
+
console.warn("Cannot get plugin version in web");
|
|
39
|
+
return { version: "default" };
|
|
40
40
|
}
|
|
41
41
|
async delete(options) {
|
|
42
|
-
console.warn(
|
|
42
|
+
console.warn("Cannot delete bundle in web", options);
|
|
43
43
|
}
|
|
44
44
|
async list() {
|
|
45
|
-
console.warn(
|
|
45
|
+
console.warn("Cannot list bundles in web");
|
|
46
46
|
return { bundles: [] };
|
|
47
47
|
}
|
|
48
48
|
async reset(options) {
|
|
49
|
-
console.warn(
|
|
49
|
+
console.warn("Cannot reset version in web", options);
|
|
50
50
|
}
|
|
51
51
|
async current() {
|
|
52
|
-
console.warn(
|
|
53
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
52
|
+
console.warn("Cannot get current bundle in web");
|
|
53
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
54
54
|
}
|
|
55
55
|
async reload() {
|
|
56
|
-
console.warn(
|
|
56
|
+
console.warn("Cannot reload current bundle in web");
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
async getLatest() {
|
|
60
|
-
console.warn(
|
|
60
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
61
61
|
return {
|
|
62
|
-
version:
|
|
63
|
-
message:
|
|
62
|
+
version: "0.0.0",
|
|
63
|
+
message: "Cannot getLatest current bundle in web",
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
async setChannel(options) {
|
|
67
|
-
console.warn(
|
|
67
|
+
console.warn("Cannot setChannel in web", options);
|
|
68
68
|
return {
|
|
69
|
-
status:
|
|
70
|
-
error:
|
|
69
|
+
status: "error",
|
|
70
|
+
error: "Cannot setChannel in web",
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
async setCustomId(options) {
|
|
74
|
-
console.warn(
|
|
74
|
+
console.warn("Cannot setCustomId in web", options);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
async getChannel() {
|
|
78
|
-
console.warn(
|
|
78
|
+
console.warn("Cannot getChannel in web");
|
|
79
79
|
return {
|
|
80
|
-
status:
|
|
81
|
-
error:
|
|
80
|
+
status: "error",
|
|
81
|
+
error: "Cannot getChannel in web",
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
async notifyAppReady() {
|
|
85
|
-
console.warn(
|
|
85
|
+
console.warn("Cannot notify App Ready in web");
|
|
86
86
|
return BUNDLE_BUILTIN;
|
|
87
87
|
}
|
|
88
88
|
async setMultiDelay(options) {
|
|
89
|
-
console.warn(
|
|
89
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
async setDelay(option) {
|
|
93
|
-
console.warn(
|
|
93
|
+
console.warn("Cannot setDelay in web", option);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
async cancelDelay() {
|
|
97
|
-
console.warn(
|
|
97
|
+
console.warn("Cannot cancelDelay in web");
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CapacitorUpdater = registerPlugin(\"CapacitorUpdater\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorUpdaterWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nconst BUNDLE_BUILTIN = {\n status: \"success\",\n version: \"\",\n downloaded: \"1970-01-01T00:00:00.000Z\",\n id: \"builtin\",\n checksum: \"\",\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn(\"Cannot download version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn(\"Cannot set next version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn(\"Cannot get isAutoUpdateEnabled in web\");\n return { enabled: false };\n }\n async set(options) {\n console.warn(\"Cannot set active bundle in web\", options);\n return;\n }\n async getDeviceId() {\n console.warn(\"Cannot get ID in web\");\n return { deviceId: \"default\" };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async delete(options) {\n console.warn(\"Cannot delete bundle in web\", options);\n }\n async list() {\n console.warn(\"Cannot list bundles in web\");\n return { bundles: [] };\n }\n async reset(options) {\n console.warn(\"Cannot reset version in web\", options);\n }\n async current() {\n console.warn(\"Cannot get current bundle in web\");\n return { bundle: BUNDLE_BUILTIN, native: \"0.0.0\" };\n }\n async reload() {\n console.warn(\"Cannot reload current bundle in web\");\n return;\n }\n async getLatest() {\n console.warn(\"Cannot getLatest current bundle in web\");\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async setChannel(options) {\n console.warn(\"Cannot setChannel in web\", options);\n return {\n status: \"error\",\n error: \"Cannot setChannel in web\",\n };\n }\n async setCustomId(options) {\n console.warn(\"Cannot setCustomId in web\", options);\n return;\n }\n async getChannel() {\n console.warn(\"Cannot getChannel in web\");\n return {\n status: \"error\",\n error: \"Cannot getChannel in web\",\n };\n }\n async notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return BUNDLE_BUILTIN;\n }\n async setMultiDelay(options) {\n console.warn(\"Cannot setMultiDelay in web\", options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn(\"Cannot setDelay in web\", option);\n return;\n }\n async cancelDelay() {\n console.warn(\"Cannot cancelDelay in web\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACvE,CAAC;;ACFD,MAAM,cAAc,GAAG;AACvB,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,UAAU,EAAE,0BAA0B;AAC1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AAE,0BAA0B;AAC7C,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACvD,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;AACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC/H,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,QAAQ,CAAC,MAAM,EAAE;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACvD,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAClD,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const CapacitorUpdater = core.registerPlugin(
|
|
4
|
+
const CapacitorUpdater = core.registerPlugin("CapacitorUpdater", {
|
|
5
5
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorUpdaterWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const BUNDLE_BUILTIN = {
|
|
9
|
-
status:
|
|
10
|
-
version:
|
|
11
|
-
downloaded:
|
|
12
|
-
id:
|
|
13
|
-
checksum:
|
|
9
|
+
status: "success",
|
|
10
|
+
version: "",
|
|
11
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
12
|
+
id: "builtin",
|
|
13
|
+
checksum: "",
|
|
14
14
|
};
|
|
15
15
|
class CapacitorUpdaterWeb extends core.WebPlugin {
|
|
16
16
|
async download(options) {
|
|
17
|
-
console.warn(
|
|
17
|
+
console.warn("Cannot download version in web", options);
|
|
18
18
|
return BUNDLE_BUILTIN;
|
|
19
19
|
}
|
|
20
20
|
async next(options) {
|
|
21
|
-
console.warn(
|
|
21
|
+
console.warn("Cannot set next version in web", options);
|
|
22
22
|
return BUNDLE_BUILTIN;
|
|
23
23
|
}
|
|
24
24
|
async isAutoUpdateEnabled() {
|
|
25
|
-
console.warn(
|
|
25
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
26
26
|
return { enabled: false };
|
|
27
27
|
}
|
|
28
28
|
async set(options) {
|
|
29
|
-
console.warn(
|
|
29
|
+
console.warn("Cannot set active bundle in web", options);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
async getDeviceId() {
|
|
33
|
-
console.warn(
|
|
34
|
-
return { deviceId:
|
|
33
|
+
console.warn("Cannot get ID in web");
|
|
34
|
+
return { deviceId: "default" };
|
|
35
35
|
}
|
|
36
36
|
async getPluginVersion() {
|
|
37
|
-
console.warn(
|
|
38
|
-
return { version:
|
|
37
|
+
console.warn("Cannot get plugin version in web");
|
|
38
|
+
return { version: "default" };
|
|
39
39
|
}
|
|
40
40
|
async delete(options) {
|
|
41
|
-
console.warn(
|
|
41
|
+
console.warn("Cannot delete bundle in web", options);
|
|
42
42
|
}
|
|
43
43
|
async list() {
|
|
44
|
-
console.warn(
|
|
44
|
+
console.warn("Cannot list bundles in web");
|
|
45
45
|
return { bundles: [] };
|
|
46
46
|
}
|
|
47
47
|
async reset(options) {
|
|
48
|
-
console.warn(
|
|
48
|
+
console.warn("Cannot reset version in web", options);
|
|
49
49
|
}
|
|
50
50
|
async current() {
|
|
51
|
-
console.warn(
|
|
52
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
51
|
+
console.warn("Cannot get current bundle in web");
|
|
52
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
53
53
|
}
|
|
54
54
|
async reload() {
|
|
55
|
-
console.warn(
|
|
55
|
+
console.warn("Cannot reload current bundle in web");
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
async getLatest() {
|
|
59
|
-
console.warn(
|
|
59
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
60
60
|
return {
|
|
61
|
-
version:
|
|
62
|
-
message:
|
|
61
|
+
version: "0.0.0",
|
|
62
|
+
message: "Cannot getLatest current bundle in web",
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
async setChannel(options) {
|
|
66
|
-
console.warn(
|
|
66
|
+
console.warn("Cannot setChannel in web", options);
|
|
67
67
|
return {
|
|
68
|
-
status:
|
|
69
|
-
error:
|
|
68
|
+
status: "error",
|
|
69
|
+
error: "Cannot setChannel in web",
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
async setCustomId(options) {
|
|
73
|
-
console.warn(
|
|
73
|
+
console.warn("Cannot setCustomId in web", options);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
async getChannel() {
|
|
77
|
-
console.warn(
|
|
77
|
+
console.warn("Cannot getChannel in web");
|
|
78
78
|
return {
|
|
79
|
-
status:
|
|
80
|
-
error:
|
|
79
|
+
status: "error",
|
|
80
|
+
error: "Cannot getChannel in web",
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
async notifyAppReady() {
|
|
84
|
-
console.warn(
|
|
84
|
+
console.warn("Cannot notify App Ready in web");
|
|
85
85
|
return BUNDLE_BUILTIN;
|
|
86
86
|
}
|
|
87
87
|
async setMultiDelay(options) {
|
|
88
|
-
console.warn(
|
|
88
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
async setDelay(option) {
|
|
92
|
-
console.warn(
|
|
92
|
+
console.warn("Cannot setDelay in web", option);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
async cancelDelay() {
|
|
96
|
-
console.warn(
|
|
96
|
+
console.warn("Cannot cancelDelay in web");
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CapacitorUpdater = registerPlugin(\"CapacitorUpdater\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorUpdaterWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nconst BUNDLE_BUILTIN = {\n status: \"success\",\n version: \"\",\n downloaded: \"1970-01-01T00:00:00.000Z\",\n id: \"builtin\",\n checksum: \"\",\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn(\"Cannot download version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn(\"Cannot set next version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn(\"Cannot get isAutoUpdateEnabled in web\");\n return { enabled: false };\n }\n async set(options) {\n console.warn(\"Cannot set active bundle in web\", options);\n return;\n }\n async getDeviceId() {\n console.warn(\"Cannot get ID in web\");\n return { deviceId: \"default\" };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async delete(options) {\n console.warn(\"Cannot delete bundle in web\", options);\n }\n async list() {\n console.warn(\"Cannot list bundles in web\");\n return { bundles: [] };\n }\n async reset(options) {\n console.warn(\"Cannot reset version in web\", options);\n }\n async current() {\n console.warn(\"Cannot get current bundle in web\");\n return { bundle: BUNDLE_BUILTIN, native: \"0.0.0\" };\n }\n async reload() {\n console.warn(\"Cannot reload current bundle in web\");\n return;\n }\n async getLatest() {\n console.warn(\"Cannot getLatest current bundle in web\");\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async setChannel(options) {\n console.warn(\"Cannot setChannel in web\", options);\n return {\n status: \"error\",\n error: \"Cannot setChannel in web\",\n };\n }\n async setCustomId(options) {\n console.warn(\"Cannot setCustomId in web\", options);\n return;\n }\n async getChannel() {\n console.warn(\"Cannot getChannel in web\");\n return {\n status: \"error\",\n error: \"Cannot getChannel in web\",\n };\n }\n async notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return BUNDLE_BUILTIN;\n }\n async setMultiDelay(options) {\n console.warn(\"Cannot setMultiDelay in web\", options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn(\"Cannot setDelay in web\", option);\n return;\n }\n async cancelDelay() {\n console.warn(\"Cannot cancelDelay in web\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICFD,MAAM,cAAc,GAAG;IACvB,IAAI,MAAM,EAAE,SAAS;IACrB,IAAI,OAAO,EAAE,EAAE;IACf,IAAI,UAAU,EAAE,0BAA0B;IAC1C,IAAI,EAAE,EAAE,SAAS;IACjB,IAAI,QAAQ,EAAE,EAAE;IAChB,CAAC,CAAC;IACK,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAChE,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,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AI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/H,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,QAAQ,CAAC,MAAM,EAAE;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACvD,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAClD,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,6 @@ import Foundation
|
|
|
2
2
|
import SSZipArchive
|
|
3
3
|
import Alamofire
|
|
4
4
|
import zlib
|
|
5
|
-
import SwiftyRSA
|
|
6
5
|
|
|
7
6
|
extension URL {
|
|
8
7
|
var isDirectory: Bool {
|
|
@@ -81,6 +80,7 @@ struct AppVersionDec: Decodable {
|
|
|
81
80
|
let checksum: String?
|
|
82
81
|
let url: String?
|
|
83
82
|
let message: String?
|
|
83
|
+
let session_key: String?
|
|
84
84
|
let major: Bool?
|
|
85
85
|
}
|
|
86
86
|
public class AppVersion: NSObject {
|
|
@@ -88,6 +88,7 @@ public class AppVersion: NSObject {
|
|
|
88
88
|
var checksum: String = ""
|
|
89
89
|
var url: String = ""
|
|
90
90
|
var message: String?
|
|
91
|
+
var sessionKey: String?
|
|
91
92
|
var major: Bool?
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -221,7 +222,7 @@ extension CustomError: LocalizedError {
|
|
|
221
222
|
public let TAG = "✨ Capacitor-updater:"
|
|
222
223
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
223
224
|
public var customId = ""
|
|
224
|
-
public let pluginVersion = "4.
|
|
225
|
+
public let pluginVersion = "4.13.2"
|
|
225
226
|
public var statsUrl = ""
|
|
226
227
|
public var channelUrl = ""
|
|
227
228
|
public var appId = ""
|
|
@@ -325,17 +326,26 @@ extension CustomError: LocalizedError {
|
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
|
|
328
|
-
private func
|
|
329
|
-
if self.privateKey == "" {
|
|
329
|
+
private func decryptFile(filePath: URL, sessionKey: String) throws {
|
|
330
|
+
if self.privateKey == "" || sessionKey == "" {
|
|
331
|
+
print("\(self.TAG) Cannot fond privateKey or sessionKey")
|
|
330
332
|
return
|
|
331
333
|
}
|
|
332
334
|
do {
|
|
333
|
-
let
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
335
|
+
guard let rsaPrivateKey: RSAPrivateKey = .load(rsaPrivateKey: self.privateKey) else {
|
|
336
|
+
print("cannot decode privateKey", self.privateKey)
|
|
337
|
+
return
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
let sessionKeyArray = sessionKey.components(separatedBy: ":")
|
|
341
|
+
let ivData = Data(base64Encoded: sessionKeyArray[0])!
|
|
342
|
+
let sessionKeyDataEncrypted = Data(base64Encoded: sessionKeyArray[1])!
|
|
343
|
+
let sessionKeyDataDecrypted: Data = rsaPrivateKey.decrypt(data: sessionKeyDataEncrypted)!
|
|
344
|
+
let aesPrivateKey: AES128Key = AES128Key(iv: ivData, aes128Key: sessionKeyDataDecrypted)
|
|
345
|
+
let encryptedData = try Data(contentsOf: filePath)
|
|
346
|
+
let decryptedData: Data = aesPrivateKey.decrypt(data: encryptedData)!
|
|
347
|
+
|
|
348
|
+
try decryptedData.write(to: filePath)
|
|
339
349
|
} catch {
|
|
340
350
|
print("\(self.TAG) Cannot decode: \(filePath.path)", error)
|
|
341
351
|
throw CustomError.cannotDecode
|
|
@@ -397,6 +407,9 @@ extension CustomError: LocalizedError {
|
|
|
397
407
|
if let message = response.value?.message {
|
|
398
408
|
latest.message = message
|
|
399
409
|
}
|
|
410
|
+
if let sessionKey = response.value?.session_key {
|
|
411
|
+
latest.sessionKey = sessionKey
|
|
412
|
+
}
|
|
400
413
|
case let .failure(error):
|
|
401
414
|
print("\(self.TAG) Error getting Latest", error )
|
|
402
415
|
}
|
|
@@ -412,7 +425,7 @@ extension CustomError: LocalizedError {
|
|
|
412
425
|
print("\(self.TAG) Current bundle set to: \(bundle == "" ? BundleInfo.ID_BUILTIN : bundle)")
|
|
413
426
|
}
|
|
414
427
|
|
|
415
|
-
public func download(url: URL, version: String) throws -> BundleInfo {
|
|
428
|
+
public func download(url: URL, version: String, sessionKey: String) throws -> BundleInfo {
|
|
416
429
|
let semaphore = DispatchSemaphore(value: 0)
|
|
417
430
|
let id: String = self.randomString(length: 10)
|
|
418
431
|
var checksum = ""
|
|
@@ -435,8 +448,8 @@ extension CustomError: LocalizedError {
|
|
|
435
448
|
case .success:
|
|
436
449
|
self.notifyDownload(id, 71)
|
|
437
450
|
do {
|
|
451
|
+
try self.decryptFile(filePath: fileURL, sessionKey: sessionKey)
|
|
438
452
|
checksum = self.getChecksum(filePath: fileURL)
|
|
439
|
-
try self.decodeFile(filePath: fileURL)
|
|
440
453
|
try self.saveDownloaded(sourceZip: fileURL, id: id, base: self.documentsDir.appendingPathComponent(self.bundleDirectoryHot))
|
|
441
454
|
self.notifyDownload(id, 85)
|
|
442
455
|
try self.saveDownloaded(sourceZip: fileURL, id: id, base: self.libraryDir.appendingPathComponent(self.bundleDirectory))
|
|
@@ -109,11 +109,12 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
109
109
|
call.reject("Download called without version")
|
|
110
110
|
return
|
|
111
111
|
}
|
|
112
|
+
let sessionKey = call.getString("sessionKey", "")
|
|
112
113
|
let url = URL(string: urlString)
|
|
113
114
|
print("\(self.implementation.TAG) Downloading \(url!)")
|
|
114
115
|
DispatchQueue.global(qos: .background).async {
|
|
115
116
|
do {
|
|
116
|
-
let res = try self.implementation.download(url: url!, version: version)
|
|
117
|
+
let res = try self.implementation.download(url: url!, version: version, sessionKey: sessionKey)
|
|
117
118
|
call.resolve(res.toJSON())
|
|
118
119
|
} catch {
|
|
119
120
|
print("\(self.implementation.TAG) Failed to download from: \(url!) \(error.localizedDescription)")
|
|
@@ -478,6 +479,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
478
479
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
479
480
|
return
|
|
480
481
|
}
|
|
482
|
+
let sessionKey = res.sessionKey ?? ""
|
|
481
483
|
guard let downloadUrl = URL(string: res.url) else {
|
|
482
484
|
print("\(self.implementation.TAG) Error no url or wrong format")
|
|
483
485
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
@@ -511,7 +513,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
511
513
|
|
|
512
514
|
do {
|
|
513
515
|
print("\(self.implementation.TAG) New bundle: \(latestVersionName) found. Current is: \(current.getVersionName()). Update will occur next time app moves to background.")
|
|
514
|
-
let next = try self.implementation.download(url: downloadUrl, version: latestVersionName)
|
|
516
|
+
let next = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey)
|
|
515
517
|
if res.checksum != "" && next.getChecksum() != res.checksum {
|
|
516
518
|
print("\(self.implementation.TAG) Error checksum", next.getChecksum(), res.checksum)
|
|
517
519
|
self.implementation.sendStats(action: "checksum_fail", versionName: next.getVersionName())
|