capacitor-ota 1.0.2 → 1.0.4
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/dist/cli/ota.mjs +2 -2
- package/dist/src/index.mjs +4 -4
- package/package.json +1 -1
package/dist/cli/ota.mjs
CHANGED
|
@@ -138,8 +138,8 @@ async function setUrl(url) {
|
|
|
138
138
|
async function showConfig() {
|
|
139
139
|
const config = loadConfig();
|
|
140
140
|
console.log("\n⚙️ Config:\n");
|
|
141
|
-
console.log(` URL:
|
|
142
|
-
console.log(` Token:
|
|
141
|
+
console.log(` API URL: ${config.url}`);
|
|
142
|
+
console.log(` Token: ${config.token ? "********" : "(not set)"}\n`);
|
|
143
143
|
}
|
|
144
144
|
function printHelp() {
|
|
145
145
|
console.log(`
|
package/dist/src/index.mjs
CHANGED
|
@@ -65,8 +65,8 @@ var OtaUpdater = class {
|
|
|
65
65
|
error: null
|
|
66
66
|
});
|
|
67
67
|
try {
|
|
68
|
-
const url = `${this.config.staticUrl}/updates/${this.config.appId}.json
|
|
69
|
-
const response = await fetch(url);
|
|
68
|
+
const url = `${this.config.staticUrl}/updates/${this.config.appId}.json`;
|
|
69
|
+
const response = await fetch(url, { cache: "no-store" });
|
|
70
70
|
if (!response.ok) {
|
|
71
71
|
if (response.status === 404) {
|
|
72
72
|
this.setState({ status: "idle" });
|
|
@@ -75,7 +75,7 @@ var OtaUpdater = class {
|
|
|
75
75
|
throw new Error(`HTTP ${response.status}`);
|
|
76
76
|
}
|
|
77
77
|
const data = await response.json();
|
|
78
|
-
if (compareVersions(data.version, this.
|
|
78
|
+
if (compareVersions(data.version, this.state.currentVersion) > 0) {
|
|
79
79
|
this.setState({ newVersion: data.version });
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
@@ -118,7 +118,7 @@ var OtaUpdater = class {
|
|
|
118
118
|
}
|
|
119
119
|
try {
|
|
120
120
|
const url = `${this.config.staticUrl}/updates/${this.config.appId}.json`;
|
|
121
|
-
const data = await (await fetch(url)).json();
|
|
121
|
+
const data = await (await fetch(url, { cache: "no-store" })).json();
|
|
122
122
|
const { CapacitorUpdater } = await import("@capgo/capacitor-updater");
|
|
123
123
|
const listener = await CapacitorUpdater.addListener("download", (event) => {
|
|
124
124
|
this.setState({ progress: event.percent });
|