@capgo/capacitor-updater 4.12.11 → 4.13.3
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 +812 -687
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1117 -829
- 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 +56 -19
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +19 -11
- package/ios/Plugin/CryptoCipher.swift +261 -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 {
|
|
@@ -20,10 +19,12 @@ extension Date {
|
|
|
20
19
|
struct SetChannelDec: Decodable {
|
|
21
20
|
let status: String?
|
|
22
21
|
let error: String?
|
|
22
|
+
let message: String?
|
|
23
23
|
}
|
|
24
24
|
public class SetChannel: NSObject {
|
|
25
25
|
var status: String = ""
|
|
26
26
|
var error: String = ""
|
|
27
|
+
var message: String = ""
|
|
27
28
|
}
|
|
28
29
|
extension SetChannel {
|
|
29
30
|
func toDict() -> [String: Any] {
|
|
@@ -41,12 +42,14 @@ struct GetChannelDec: Decodable {
|
|
|
41
42
|
let channel: String?
|
|
42
43
|
let status: String?
|
|
43
44
|
let error: String?
|
|
45
|
+
let message: String?
|
|
44
46
|
let allowSet: Bool?
|
|
45
47
|
}
|
|
46
48
|
public class GetChannel: NSObject {
|
|
47
49
|
var channel: String = ""
|
|
48
50
|
var status: String = ""
|
|
49
51
|
var error: String = ""
|
|
52
|
+
var message: String = ""
|
|
50
53
|
var allowSet: Bool = true
|
|
51
54
|
}
|
|
52
55
|
extension GetChannel {
|
|
@@ -81,6 +84,8 @@ struct AppVersionDec: Decodable {
|
|
|
81
84
|
let checksum: String?
|
|
82
85
|
let url: String?
|
|
83
86
|
let message: String?
|
|
87
|
+
let error: String?
|
|
88
|
+
let session_key: String?
|
|
84
89
|
let major: Bool?
|
|
85
90
|
}
|
|
86
91
|
public class AppVersion: NSObject {
|
|
@@ -88,6 +93,8 @@ public class AppVersion: NSObject {
|
|
|
88
93
|
var checksum: String = ""
|
|
89
94
|
var url: String = ""
|
|
90
95
|
var message: String?
|
|
96
|
+
var error: String?
|
|
97
|
+
var sessionKey: String?
|
|
91
98
|
var major: Bool?
|
|
92
99
|
}
|
|
93
100
|
|
|
@@ -221,7 +228,7 @@ extension CustomError: LocalizedError {
|
|
|
221
228
|
public let TAG = "✨ Capacitor-updater:"
|
|
222
229
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
223
230
|
public var customId = ""
|
|
224
|
-
public let pluginVersion = "4.
|
|
231
|
+
public let pluginVersion = "4.13.3"
|
|
225
232
|
public var statsUrl = ""
|
|
226
233
|
public var channelUrl = ""
|
|
227
234
|
public var appId = ""
|
|
@@ -325,17 +332,26 @@ extension CustomError: LocalizedError {
|
|
|
325
332
|
}
|
|
326
333
|
}
|
|
327
334
|
|
|
328
|
-
private func
|
|
329
|
-
if self.privateKey == "" {
|
|
335
|
+
private func decryptFile(filePath: URL, sessionKey: String) throws {
|
|
336
|
+
if self.privateKey == "" || sessionKey == "" {
|
|
337
|
+
print("\(self.TAG) Cannot fond privateKey or sessionKey")
|
|
330
338
|
return
|
|
331
339
|
}
|
|
332
340
|
do {
|
|
333
|
-
let
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
guard let rsaPrivateKey: RSAPrivateKey = .load(rsaPrivateKey: self.privateKey) else {
|
|
342
|
+
print("cannot decode privateKey", self.privateKey)
|
|
343
|
+
return
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
let sessionKeyArray = sessionKey.components(separatedBy: ":")
|
|
347
|
+
let ivData = Data(base64Encoded: sessionKeyArray[0])!
|
|
348
|
+
let sessionKeyDataEncrypted = Data(base64Encoded: sessionKeyArray[1])!
|
|
349
|
+
let sessionKeyDataDecrypted: Data = rsaPrivateKey.decrypt(data: sessionKeyDataEncrypted)!
|
|
350
|
+
let aesPrivateKey: AES128Key = AES128Key(iv: ivData, aes128Key: sessionKeyDataDecrypted)
|
|
351
|
+
let encryptedData = try Data(contentsOf: filePath)
|
|
352
|
+
let decryptedData: Data = aesPrivateKey.decrypt(data: encryptedData)!
|
|
353
|
+
|
|
354
|
+
try decryptedData.write(to: filePath)
|
|
339
355
|
} catch {
|
|
340
356
|
print("\(self.TAG) Cannot decode: \(filePath.path)", error)
|
|
341
357
|
throw CustomError.cannotDecode
|
|
@@ -397,8 +413,16 @@ extension CustomError: LocalizedError {
|
|
|
397
413
|
if let message = response.value?.message {
|
|
398
414
|
latest.message = message
|
|
399
415
|
}
|
|
416
|
+
if let error = response.value?.error {
|
|
417
|
+
latest.error = error
|
|
418
|
+
}
|
|
419
|
+
if let sessionKey = response.value?.session_key {
|
|
420
|
+
latest.sessionKey = sessionKey
|
|
421
|
+
}
|
|
400
422
|
case let .failure(error):
|
|
401
423
|
print("\(self.TAG) Error getting Latest", error )
|
|
424
|
+
latest.message = "Error getting Latest \(error)"
|
|
425
|
+
latest.error = "fail_response"
|
|
402
426
|
}
|
|
403
427
|
semaphore.signal()
|
|
404
428
|
}
|
|
@@ -412,7 +436,7 @@ extension CustomError: LocalizedError {
|
|
|
412
436
|
print("\(self.TAG) Current bundle set to: \(bundle == "" ? BundleInfo.ID_BUILTIN : bundle)")
|
|
413
437
|
}
|
|
414
438
|
|
|
415
|
-
public func download(url: URL, version: String) throws -> BundleInfo {
|
|
439
|
+
public func download(url: URL, version: String, sessionKey: String) throws -> BundleInfo {
|
|
416
440
|
let semaphore = DispatchSemaphore(value: 0)
|
|
417
441
|
let id: String = self.randomString(length: 10)
|
|
418
442
|
var checksum = ""
|
|
@@ -435,8 +459,8 @@ extension CustomError: LocalizedError {
|
|
|
435
459
|
case .success:
|
|
436
460
|
self.notifyDownload(id, 71)
|
|
437
461
|
do {
|
|
462
|
+
try self.decryptFile(filePath: fileURL, sessionKey: sessionKey)
|
|
438
463
|
checksum = self.getChecksum(filePath: fileURL)
|
|
439
|
-
try self.decodeFile(filePath: fileURL)
|
|
440
464
|
try self.saveDownloaded(sourceZip: fileURL, id: id, base: self.documentsDir.appendingPathComponent(self.bundleDirectoryHot))
|
|
441
465
|
self.notifyDownload(id, 85)
|
|
442
466
|
try self.saveDownloaded(sourceZip: fileURL, id: id, base: self.libraryDir.appendingPathComponent(self.bundleDirectory))
|
|
@@ -594,12 +618,15 @@ extension CustomError: LocalizedError {
|
|
|
594
618
|
self.setBundleStatus(id: bundle.getId(), status: BundleStatus.ERROR)
|
|
595
619
|
}
|
|
596
620
|
|
|
597
|
-
func setChannel(channel: String) -> SetChannel
|
|
621
|
+
func setChannel(channel: String) -> SetChannel {
|
|
622
|
+
let setChannel = SetChannel()
|
|
598
623
|
if self.channelUrl == "" {
|
|
599
|
-
|
|
624
|
+
print("\(self.TAG) Channel URL is not set")
|
|
625
|
+
setChannel.message = "Channel URL is not set"
|
|
626
|
+
setChannel.error = "missing_config"
|
|
627
|
+
return setChannel
|
|
600
628
|
}
|
|
601
629
|
let semaphore = DispatchSemaphore(value: 0)
|
|
602
|
-
let setChannel = SetChannel()
|
|
603
630
|
var parameters: InfoObject = self.createInfoObject()
|
|
604
631
|
parameters.channel = channel
|
|
605
632
|
|
|
@@ -614,8 +641,13 @@ extension CustomError: LocalizedError {
|
|
|
614
641
|
if let error = response.value?.error {
|
|
615
642
|
setChannel.error = error
|
|
616
643
|
}
|
|
644
|
+
if let message = response.value?.message {
|
|
645
|
+
setChannel.message = message
|
|
646
|
+
}
|
|
617
647
|
case let .failure(error):
|
|
618
|
-
print("\(self.TAG) Error set Channel", error
|
|
648
|
+
print("\(self.TAG) Error set Channel", error)
|
|
649
|
+
setChannel.message = "Error set Channel \(error)"
|
|
650
|
+
setChannel.error = "fail_response"
|
|
619
651
|
}
|
|
620
652
|
semaphore.signal()
|
|
621
653
|
}
|
|
@@ -623,12 +655,15 @@ extension CustomError: LocalizedError {
|
|
|
623
655
|
return setChannel
|
|
624
656
|
}
|
|
625
657
|
|
|
626
|
-
func getChannel() -> GetChannel
|
|
658
|
+
func getChannel() -> GetChannel {
|
|
659
|
+
let getChannel = GetChannel()
|
|
627
660
|
if self.channelUrl == "" {
|
|
628
|
-
|
|
661
|
+
print("\(self.TAG) Channel URL is not set")
|
|
662
|
+
getChannel.message = "Channel URL is not set"
|
|
663
|
+
getChannel.error = "missing_config"
|
|
664
|
+
return getChannel
|
|
629
665
|
}
|
|
630
666
|
let semaphore = DispatchSemaphore(value: 0)
|
|
631
|
-
let getChannel = GetChannel()
|
|
632
667
|
let parameters: InfoObject = self.createInfoObject()
|
|
633
668
|
let request = AF.request(self.channelUrl, method: .put, parameters: parameters, encoder: JSONParameterEncoder.default)
|
|
634
669
|
|
|
@@ -649,6 +684,8 @@ extension CustomError: LocalizedError {
|
|
|
649
684
|
}
|
|
650
685
|
case let .failure(error):
|
|
651
686
|
print("\(self.TAG) Error get Channel", error )
|
|
687
|
+
getChannel.message = "Error get Channel \(error)"
|
|
688
|
+
getChannel.error = "fail_response"
|
|
652
689
|
}
|
|
653
690
|
semaphore.signal()
|
|
654
691
|
}
|
|
@@ -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)")
|
|
@@ -208,7 +209,11 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
208
209
|
@objc func getLatest(_ call: CAPPluginCall) {
|
|
209
210
|
DispatchQueue.global(qos: .background).async {
|
|
210
211
|
let res = self.implementation.getLatest(url: URL(string: self.updateUrl)!)
|
|
211
|
-
|
|
212
|
+
if res.error != nil {
|
|
213
|
+
call.reject( res.error!)
|
|
214
|
+
} else {
|
|
215
|
+
call.resolve(res.toDict())
|
|
216
|
+
}
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
|
|
@@ -219,21 +224,23 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
219
224
|
return
|
|
220
225
|
}
|
|
221
226
|
DispatchQueue.global(qos: .background).async {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
let res = self.implementation.setChannel(channel: channel)
|
|
228
|
+
if res.error != "" {
|
|
229
|
+
call.reject(res.error)
|
|
230
|
+
} else {
|
|
231
|
+
call.resolve(res.toDict())
|
|
225
232
|
}
|
|
226
|
-
call.resolve(res.toDict())
|
|
227
233
|
}
|
|
228
234
|
}
|
|
229
235
|
|
|
230
236
|
@objc func getChannel(_ call: CAPPluginCall) {
|
|
231
237
|
DispatchQueue.global(qos: .background).async {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
let res = self.implementation.getChannel()
|
|
239
|
+
if res.error != "" {
|
|
240
|
+
call.reject(res.error)
|
|
241
|
+
} else {
|
|
242
|
+
call.resolve(res.toDict())
|
|
235
243
|
}
|
|
236
|
-
call.resolve(res.toDict())
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
@objc func setCustomId(_ call: CAPPluginCall) {
|
|
@@ -478,6 +485,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
478
485
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
479
486
|
return
|
|
480
487
|
}
|
|
488
|
+
let sessionKey = res.sessionKey ?? ""
|
|
481
489
|
guard let downloadUrl = URL(string: res.url) else {
|
|
482
490
|
print("\(self.implementation.TAG) Error no url or wrong format")
|
|
483
491
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
@@ -511,7 +519,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
511
519
|
|
|
512
520
|
do {
|
|
513
521
|
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)
|
|
522
|
+
let next = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey)
|
|
515
523
|
if res.checksum != "" && next.getChecksum() != res.checksum {
|
|
516
524
|
print("\(self.implementation.TAG) Error checksum", next.getChecksum(), res.checksum)
|
|
517
525
|
self.implementation.sendStats(action: "checksum_fail", versionName: next.getVersionName())
|