@capgo/capacitor-updater 8.53.1 → 8.54.0
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 +31 -15
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +187 -16
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +179 -18
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +82 -19
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +147 -29
- package/dist/docs.json +34 -2
- package/dist/esm/definitions.d.ts +46 -2
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +44 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +278 -56
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +59 -33
- package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +0 -19
- package/ios/Sources/CapacitorUpdaterPlugin/RedirectPolicyDelegate.swift +20 -0
- package/package.json +1 -1
|
@@ -123,9 +123,10 @@ public class DownloadService extends Worker {
|
|
|
123
123
|
public static final String DEFAULT_CHANNEL = "default_channel";
|
|
124
124
|
public static final String IS_PROD = "is_prod";
|
|
125
125
|
public static final String IS_EMULATOR = "is_emulator";
|
|
126
|
-
//
|
|
126
|
+
// 32 files in flight on every device. Fewer leaves 2-core phones waiting on per-request latency;
|
|
127
|
+
// capping by CPU count (8 on 4 cores) was 2-4x slower on emulators limited to 2, 4 and 8 cores.
|
|
127
128
|
// Keep the global cap at 64 so API calls on another host are not starved by manifest downloads.
|
|
128
|
-
|
|
129
|
+
static final int MANIFEST_MAX_CONCURRENT_FILES = 32;
|
|
129
130
|
private static final int SHARED_MAX_REQUESTS = 64;
|
|
130
131
|
private static final String UPDATE_FILE = "update.dat";
|
|
131
132
|
|
|
@@ -137,6 +138,9 @@ public class DownloadService extends Worker {
|
|
|
137
138
|
private static volatile int httpTimeoutMs = 20_000;
|
|
138
139
|
// Off by default: a redirect must never downgrade updater traffic from HTTPS to plain HTTP.
|
|
139
140
|
private static volatile boolean allowHttpsToHttpRedirect = false;
|
|
141
|
+
// Config httpsOnly (default true): every request and every redirect hop through sharedClient must be https.
|
|
142
|
+
// When true it overrides allowHttpsToHttpRedirect: an https -> http redirect is rejected even if that flag is set.
|
|
143
|
+
static volatile boolean httpsOnly = true;
|
|
140
144
|
private static String currentAppId = "unknown";
|
|
141
145
|
private static String currentPluginVersion = "unknown";
|
|
142
146
|
private static String currentVersionOs = "unknown";
|
|
@@ -157,15 +161,26 @@ public class DownloadService extends Worker {
|
|
|
157
161
|
.writeTimeout(httpTimeoutMs, TimeUnit.MILLISECONDS)
|
|
158
162
|
.addInterceptor((chain) -> {
|
|
159
163
|
Request originalRequest = chain.request();
|
|
164
|
+
// Reject plain http before OkHttp opens a connection (the network interceptor below covers redirect hops).
|
|
165
|
+
assertHttpsAllowed(originalRequest);
|
|
160
166
|
String userAgent = buildUserAgent(currentAppId, currentPluginVersion, currentVersionOs);
|
|
161
167
|
Request requestWithUserAgent = originalRequest.newBuilder().header("User-Agent", userAgent).build();
|
|
162
168
|
return chain.proceed(requestWithUserAgent);
|
|
163
169
|
})
|
|
164
170
|
.addNetworkInterceptor((chain) -> {
|
|
171
|
+
// Network interceptor: runs once per hop, so a redirect to http is rejected here too.
|
|
172
|
+
assertHttpsAllowed(chain.request());
|
|
165
173
|
Response response = chain.proceed(chain.request());
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
if (isHttpsToHttpRedirect(response)) {
|
|
175
|
+
if (httpsOnly) {
|
|
176
|
+
String location = response.header("Location");
|
|
177
|
+
response.close();
|
|
178
|
+
throw new IOException(CapgoUpdater.httpsOnlyMessage(location));
|
|
179
|
+
}
|
|
180
|
+
if (!allowHttpsToHttpRedirect) {
|
|
181
|
+
response.close();
|
|
182
|
+
throw new BlockedRedirectException();
|
|
183
|
+
}
|
|
169
184
|
}
|
|
170
185
|
return response;
|
|
171
186
|
})
|
|
@@ -176,6 +191,21 @@ public class DownloadService extends Worker {
|
|
|
176
191
|
allowHttpsToHttpRedirect = allow;
|
|
177
192
|
}
|
|
178
193
|
|
|
194
|
+
static void setHttpsOnly(boolean enabled) {
|
|
195
|
+
httpsOnly = enabled;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** httpsOnly gate shared by both interceptors; throws for any non-https request when enabled. */
|
|
199
|
+
static void assertHttpsAllowed(Request request) throws IOException {
|
|
200
|
+
if (httpsOnly && !request.isHttps()) {
|
|
201
|
+
String message = CapgoUpdater.httpsOnlyMessage(request.url().toString());
|
|
202
|
+
if (logger != null) {
|
|
203
|
+
logger.error(message);
|
|
204
|
+
}
|
|
205
|
+
throw new IOException(message);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
179
209
|
static boolean isHttpsToHttpRedirect(Response response) {
|
|
180
210
|
if (!response.isRedirect() || !response.request().isHttps()) {
|
|
181
211
|
return false;
|
|
@@ -215,12 +245,7 @@ public class DownloadService extends Worker {
|
|
|
215
245
|
}
|
|
216
246
|
|
|
217
247
|
static int manifestMaxConcurrentFiles() {
|
|
218
|
-
return
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
static int manifestMaxConcurrentFiles(int processors) {
|
|
222
|
-
int cores = Math.max(1, processors);
|
|
223
|
-
return Math.min(64, Math.max(8, cores * 2));
|
|
248
|
+
return MANIFEST_MAX_CONCURRENT_FILES;
|
|
224
249
|
}
|
|
225
250
|
|
|
226
251
|
static String buildUserAgent(String appId, String pluginVersion, String versionOs) {
|
|
@@ -262,6 +287,8 @@ public class DownloadService extends Worker {
|
|
|
262
287
|
}
|
|
263
288
|
}
|
|
264
289
|
|
|
290
|
+
private int lastProgressPercent = -1;
|
|
291
|
+
|
|
265
292
|
public DownloadService(@NonNull Context context, @NonNull WorkerParameters params) {
|
|
266
293
|
super(context, params);
|
|
267
294
|
// Use shared client - no need to create new instances
|
|
@@ -271,7 +298,9 @@ public class DownloadService extends Worker {
|
|
|
271
298
|
cleanupOldTempFiles(new File(getApplicationContext().getCacheDir(), "capgo_downloads"));
|
|
272
299
|
}
|
|
273
300
|
|
|
274
|
-
private void setProgress(int percent) {
|
|
301
|
+
private synchronized void setProgress(int percent) {
|
|
302
|
+
if (percent <= lastProgressPercent) return;
|
|
303
|
+
lastProgressPercent = percent;
|
|
275
304
|
Data progress = new Data.Builder().putInt(PERCENT, percent).build();
|
|
276
305
|
setProgressAsync(progress);
|
|
277
306
|
}
|
|
@@ -715,6 +744,7 @@ public class DownloadService extends Worker {
|
|
|
715
744
|
}
|
|
716
745
|
}
|
|
717
746
|
|
|
747
|
+
CryptoCipher.DecryptionSession decryptionSession = new CryptoCipher.DecryptionSession(publicKey, sessionKey);
|
|
718
748
|
ExecutorService executor = Executors.newFixedThreadPool(Math.min(MANIFEST_MAX_CONCURRENT_FILES, Math.max(1, totalFiles)));
|
|
719
749
|
List<Future<?>> futures = new ArrayList<>();
|
|
720
750
|
|
|
@@ -736,8 +766,7 @@ public class DownloadService extends Worker {
|
|
|
736
766
|
task.targetFile,
|
|
737
767
|
task.cacheFile,
|
|
738
768
|
task.finalFileHash,
|
|
739
|
-
|
|
740
|
-
publicKey,
|
|
769
|
+
decryptionSession,
|
|
741
770
|
task.isBrotli,
|
|
742
771
|
task.fileName
|
|
743
772
|
);
|
|
@@ -1119,7 +1148,7 @@ public class DownloadService extends Worker {
|
|
|
1119
1148
|
// Hash is in the cache file name and was verified when written.
|
|
1120
1149
|
// Re-hashing here would re-read every reused file on low-RAM devices.
|
|
1121
1150
|
try {
|
|
1122
|
-
|
|
1151
|
+
linkOrCopyImmutableFile(source, dest);
|
|
1123
1152
|
return true;
|
|
1124
1153
|
} catch (IOException e) {
|
|
1125
1154
|
// File was deleted between check and copy, or other IO error - caller should download instead
|
|
@@ -1128,6 +1157,27 @@ public class DownloadService extends Worker {
|
|
|
1128
1157
|
}
|
|
1129
1158
|
}
|
|
1130
1159
|
|
|
1160
|
+
// Only updater-owned verified bundle/cache files, which are never rewritten in place.
|
|
1161
|
+
static void linkOrCopyImmutableFile(File source, File dest) throws IOException {
|
|
1162
|
+
File parent = dest.getParentFile();
|
|
1163
|
+
if (parent != null && !parent.isDirectory() && !parent.mkdirs()) throw new IOException("Cannot create cache directory");
|
|
1164
|
+
File temp = File.createTempFile("capgo-link-", ".tmp", parent);
|
|
1165
|
+
try {
|
|
1166
|
+
if (!temp.delete()) throw new IOException("Cannot prepare cache link");
|
|
1167
|
+
try {
|
|
1168
|
+
android.system.Os.link(source.getCanonicalPath(), temp.getAbsolutePath());
|
|
1169
|
+
} catch (Exception unsupported) {
|
|
1170
|
+
try (FileInputStream input = new FileInputStream(source)) {
|
|
1171
|
+
writeFileAtomic(dest, input, null);
|
|
1172
|
+
}
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
CryptoCipher.replaceFile(temp, dest);
|
|
1176
|
+
} finally {
|
|
1177
|
+
if (temp.exists() && !temp.delete()) temp.deleteOnExit();
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1131
1181
|
private void copyFile(File source, File dest) throws IOException {
|
|
1132
1182
|
copyFileChannel(source, dest);
|
|
1133
1183
|
}
|
|
@@ -1169,8 +1219,46 @@ public class DownloadService extends Worker {
|
|
|
1169
1219
|
File targetFile,
|
|
1170
1220
|
File cacheFile,
|
|
1171
1221
|
String expectedHash,
|
|
1172
|
-
|
|
1173
|
-
|
|
1222
|
+
CryptoCipher.DecryptionSession decryptionSession,
|
|
1223
|
+
boolean isBrotli,
|
|
1224
|
+
String relativeName
|
|
1225
|
+
) throws Exception {
|
|
1226
|
+
for (int attempt = 1; ; attempt++) {
|
|
1227
|
+
if (isStopped()) throw new IOException("download_stopped");
|
|
1228
|
+
try {
|
|
1229
|
+
downloadAndVerifyOnce(downloadUrl, targetFile, cacheFile, expectedHash, decryptionSession, isBrotli, relativeName);
|
|
1230
|
+
return;
|
|
1231
|
+
} catch (Exception error) {
|
|
1232
|
+
if (attempt >= 3 || !isRetryableManifestError(error)) throw error;
|
|
1233
|
+
for (int tick = 0; tick < 5 * attempt; tick++) {
|
|
1234
|
+
if (isStopped()) throw new IOException("download_stopped");
|
|
1235
|
+
Thread.sleep(50);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
static boolean isRetryableManifestError(Throwable error) {
|
|
1242
|
+
for (Throwable cause = error; cause != null; cause = cause.getCause()) {
|
|
1243
|
+
if (cause instanceof BlockedRedirectException || cause instanceof javax.net.ssl.SSLException) return false;
|
|
1244
|
+
if (
|
|
1245
|
+
cause instanceof DownloadRetryException ||
|
|
1246
|
+
cause instanceof java.net.SocketException ||
|
|
1247
|
+
cause instanceof java.net.SocketTimeoutException ||
|
|
1248
|
+
cause instanceof java.net.UnknownHostException ||
|
|
1249
|
+
cause instanceof java.net.ProtocolException ||
|
|
1250
|
+
cause instanceof java.io.EOFException
|
|
1251
|
+
) return true;
|
|
1252
|
+
}
|
|
1253
|
+
return false;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
private void downloadAndVerifyOnce(
|
|
1257
|
+
String downloadUrl,
|
|
1258
|
+
File targetFile,
|
|
1259
|
+
File cacheFile,
|
|
1260
|
+
String expectedHash,
|
|
1261
|
+
CryptoCipher.DecryptionSession decryptionSession,
|
|
1174
1262
|
boolean isBrotli,
|
|
1175
1263
|
String relativeName
|
|
1176
1264
|
) throws Exception {
|
|
@@ -1181,9 +1269,11 @@ public class DownloadService extends Worker {
|
|
|
1181
1269
|
if (!cacheFolder.exists() && !cacheFolder.mkdirs()) {
|
|
1182
1270
|
throw new IOException("Failed to create cache directory: " + cacheFolder.getAbsolutePath());
|
|
1183
1271
|
}
|
|
1184
|
-
File partial = manifestPartialFile(cacheFolder, expectedHash, relativeName);
|
|
1272
|
+
File partial = manifestPartialFile(cacheFolder, getInputData().getString(ID), expectedHash, relativeName);
|
|
1185
1273
|
File workFile = null;
|
|
1186
1274
|
boolean keepPartial = partial.isFile();
|
|
1275
|
+
// True while the bytes on disk come from more than one response; a bad result then earns a clean GET.
|
|
1276
|
+
boolean resumed = false;
|
|
1187
1277
|
try {
|
|
1188
1278
|
long existing = partial.isFile() ? partial.length() : 0;
|
|
1189
1279
|
Request.Builder builder = new Request.Builder().url(downloadUrl);
|
|
@@ -1195,16 +1285,32 @@ public class DownloadService extends Worker {
|
|
|
1195
1285
|
if (code == 416 && existing > 0) {
|
|
1196
1286
|
logger.debug("Range not satisfiable, using existing partial " + partial.getName());
|
|
1197
1287
|
keepPartial = true;
|
|
1288
|
+
resumed = true;
|
|
1198
1289
|
} else if (code != HttpURLConnection.HTTP_OK && code != HttpURLConnection.HTTP_PARTIAL) {
|
|
1199
|
-
|
|
1290
|
+
// Reported once after the last attempt by the task catch in handleManifestDownload.
|
|
1291
|
+
if (code != 429 && isRetryableHttpStatus(code)) {
|
|
1292
|
+
throw new DownloadRetryException("Unexpected response code: " + code);
|
|
1293
|
+
}
|
|
1200
1294
|
throw new IOException("Unexpected response code: " + code);
|
|
1201
1295
|
} else {
|
|
1202
1296
|
ResponseBody responseBody = response.body();
|
|
1203
1297
|
if (responseBody == null) {
|
|
1204
1298
|
throw new IOException("Response body is null");
|
|
1205
1299
|
}
|
|
1300
|
+
int writeCode = code;
|
|
1301
|
+
if (code == HttpURLConnection.HTTP_PARTIAL && existing > 0) {
|
|
1302
|
+
long rangeStart = parseContentRangeStart(response.header("Content-Range"));
|
|
1303
|
+
if (rangeStart == 0) {
|
|
1304
|
+
writeCode = HttpURLConnection.HTTP_OK;
|
|
1305
|
+
} else if (rangeStart == existing) {
|
|
1306
|
+
resumed = true;
|
|
1307
|
+
} else {
|
|
1308
|
+
keepPartial = false;
|
|
1309
|
+
throw new DownloadRetryException("invalid_content_range");
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1206
1312
|
try {
|
|
1207
|
-
writeHttpBody(partial, responseBody.byteStream(),
|
|
1313
|
+
writeHttpBody(partial, responseBody.byteStream(), writeCode, existing);
|
|
1208
1314
|
keepPartial = true;
|
|
1209
1315
|
} catch (Exception e) {
|
|
1210
1316
|
keepPartial = true;
|
|
@@ -1213,17 +1319,18 @@ public class DownloadService extends Worker {
|
|
|
1213
1319
|
}
|
|
1214
1320
|
}
|
|
1215
1321
|
|
|
1216
|
-
boolean needDecrypt =
|
|
1322
|
+
boolean needDecrypt = decryptionSession.isEncrypted();
|
|
1217
1323
|
File source = partial;
|
|
1218
1324
|
if (needDecrypt) {
|
|
1219
1325
|
workFile = new File(cacheFolder, "work_" + UUID.randomUUID() + "_" + targetFile.getName() + ".tmp");
|
|
1220
1326
|
copyFile(partial, workFile);
|
|
1221
1327
|
try {
|
|
1222
1328
|
logger.debug("Decrypting file " + targetFile.getName());
|
|
1223
|
-
|
|
1329
|
+
decryptionSession.decryptFile(workFile);
|
|
1224
1330
|
source = workFile;
|
|
1225
1331
|
} catch (Exception e) {
|
|
1226
1332
|
keepPartial = false;
|
|
1333
|
+
if (resumed) throw new DownloadRetryException("resumed_partial_failed_decryption", e);
|
|
1227
1334
|
throw e;
|
|
1228
1335
|
}
|
|
1229
1336
|
}
|
|
@@ -1238,10 +1345,17 @@ public class DownloadService extends Worker {
|
|
|
1238
1345
|
}
|
|
1239
1346
|
} catch (IOException e) {
|
|
1240
1347
|
String msg = e.getMessage();
|
|
1241
|
-
|
|
1348
|
+
boolean checksumFailed = msg != null && msg.contains("Checksum verification failed");
|
|
1349
|
+
boolean brotliFailed = isBrotli && msg != null && msg.toLowerCase(java.util.Locale.US).contains("brotli");
|
|
1350
|
+
// Only bad bytes earn a clean GET; local storage errors stay permanent.
|
|
1351
|
+
if (resumed && (checksumFailed || brotliFailed)) {
|
|
1352
|
+
keepPartial = false;
|
|
1353
|
+
throw new DownloadRetryException("resumed_partial_failed_verification", e);
|
|
1354
|
+
}
|
|
1355
|
+
if (checksumFailed) {
|
|
1242
1356
|
sendStatsAsync("download_manifest_checksum_fail", getInputData().getString(VERSION) + ":" + finalTargetFile.getName());
|
|
1243
1357
|
keepPartial = false;
|
|
1244
|
-
} else if (
|
|
1358
|
+
} else if (brotliFailed) {
|
|
1245
1359
|
sendStatsAsync("download_manifest_brotli_fail", getInputData().getString(VERSION) + ":" + finalTargetFile.getName());
|
|
1246
1360
|
keepPartial = false;
|
|
1247
1361
|
}
|
|
@@ -1252,8 +1366,10 @@ public class DownloadService extends Worker {
|
|
|
1252
1366
|
CryptoCipher.logChecksumInfo("Expected checksum", expectedHash);
|
|
1253
1367
|
|
|
1254
1368
|
if (cacheFile != null) {
|
|
1255
|
-
try
|
|
1256
|
-
|
|
1369
|
+
try {
|
|
1370
|
+
linkOrCopyImmutableFile(finalTargetFile, cacheFile);
|
|
1371
|
+
} catch (IOException error) {
|
|
1372
|
+
logger.debug("Delta cache write failed: " + error.getMessage());
|
|
1257
1373
|
}
|
|
1258
1374
|
}
|
|
1259
1375
|
keepPartial = false;
|
|
@@ -1273,13 +1389,15 @@ public class DownloadService extends Worker {
|
|
|
1273
1389
|
return CryptoCipher.shortPathKey(fileName);
|
|
1274
1390
|
}
|
|
1275
1391
|
|
|
1276
|
-
|
|
1392
|
+
// Scoped to one download so concurrent downloads of the same file never write one partial.
|
|
1393
|
+
static File manifestPartialFile(File cacheDir, String downloadId, String hash, String fileName) {
|
|
1394
|
+
String owner = CryptoCipher.shortPathKey(downloadId == null ? "" : downloadId);
|
|
1277
1395
|
String token = safePartialToken(fileName);
|
|
1278
1396
|
if (CapgoUpdater.isSafeCacheHash(hash) && hash.length() == 64) {
|
|
1279
|
-
return new File(cacheDir, "partial_" + hash + "_" + token + ".tmp");
|
|
1397
|
+
return new File(cacheDir, "partial_" + owner + "_" + hash + "_" + token + ".tmp");
|
|
1280
1398
|
}
|
|
1281
1399
|
String digest = CryptoCipher.shortPathKey((hash == null ? "" : hash) + "\0" + (fileName == null ? "" : fileName));
|
|
1282
|
-
return new File(cacheDir, "partial_" + digest + "_" + token + ".tmp");
|
|
1400
|
+
return new File(cacheDir, "partial_" + owner + "_" + digest + "_" + token + ".tmp");
|
|
1283
1401
|
}
|
|
1284
1402
|
|
|
1285
1403
|
static boolean shouldAppendHttpBody(int statusCode, long existingBytes) {
|
package/dist/docs.json
CHANGED
|
@@ -4934,7 +4934,7 @@
|
|
|
4934
4934
|
"name": "since"
|
|
4935
4935
|
}
|
|
4936
4936
|
],
|
|
4937
|
-
"docs": "Configure the public key for end to end live update encryption Version 2\n\nOnly available for Android and iOS.",
|
|
4937
|
+
"docs": "Configure the public key for end to end live update encryption Version 2.\n\nWhat it guarantees: a bundle can only be installed when its checksum and session key were produced with\nthe matching private key. Capgo never holds that key, so Capgo cannot create, modify or decrypt an update\nfor your app. It does NOT make the bundle unreadable to someone who has your app binary: the public key\nships inside the app, and anyone holding the app can recover the session key and read the bundle. If you\nalso need Capgo to be unable to find your app (and so its public key), use a Capgo app id that is not your\nstore bundle id (`appId` in this plugin config) so the app is not identifiable from the dashboard.\n\nOnly available for Android and iOS.",
|
|
4938
4938
|
"complexTypes": [],
|
|
4939
4939
|
"type": "string | undefined"
|
|
4940
4940
|
},
|
|
@@ -5182,7 +5182,39 @@
|
|
|
5182
5182
|
"name": "since"
|
|
5183
5183
|
}
|
|
5184
5184
|
],
|
|
5185
|
-
"docs": "Allow the plugin to follow redirects from HTTPS to plain HTTP for its own network requests\n(update checks, stats, channel calls, and bundle/manifest downloads).\n\nBlocked by default so a redirect can never downgrade updater traffic to an unencrypted connection.\nOnly enable this if your self-hosted update server or CDN must redirect to an HTTP URL.\
|
|
5185
|
+
"docs": "Allow the plugin to follow redirects from HTTPS to plain HTTP for its own network requests\n(update checks, stats, channel calls, and bundle/manifest downloads).\n\nBlocked by default so a redirect can never downgrade updater traffic to an unencrypted connection.\nOnly enable this if your self-hosted update server or CDN must redirect to an HTTP URL.\n`httpsOnly` (default `true`) rejects every non-https URL and redirect hop regardless of this setting, so an\nHTTP redirect also needs `httpsOnly: false`. Direct HTTP URLs (for example `localApi` during development) are\nonly allowed with `httpsOnly: false` as well.\n\nOnly available for Android and iOS.",
|
|
5186
|
+
"complexTypes": [],
|
|
5187
|
+
"type": "boolean | undefined"
|
|
5188
|
+
},
|
|
5189
|
+
{
|
|
5190
|
+
"name": "httpsOnly",
|
|
5191
|
+
"tags": [
|
|
5192
|
+
{
|
|
5193
|
+
"text": "true",
|
|
5194
|
+
"name": "default"
|
|
5195
|
+
},
|
|
5196
|
+
{
|
|
5197
|
+
"text": "8.54.0",
|
|
5198
|
+
"name": "since"
|
|
5199
|
+
}
|
|
5200
|
+
],
|
|
5201
|
+
"docs": "Require https for every URL the plugin talks to: `updateUrl`, `statsUrl`, `channelUrl` (from config,\npersisted values and `setUpdateUrl` / `setStatsUrl` / `setChannelUrl`), bundle zip URLs, every manifest\n`download_url`, preview payload URLs and every redirect hop. When enabled it overrides\n`allowHttpsToHttpRedirect`. A non-https URL fails the call or download with\n`httpsOnly is enabled and <url> is not https`.\n\nSet to `false` only for local development servers (for example a plain-http `localApi` on loopback) or a\nself-hosted plain-http update server you control. Upgrading with a plain-http `updateUrl`, `statsUrl`,\n`channelUrl` or `allowHttpsToHttpRedirect: true` requires setting this to `false` explicitly.\n\nOnly available for Android and iOS.",
|
|
5202
|
+
"complexTypes": [],
|
|
5203
|
+
"type": "boolean | undefined"
|
|
5204
|
+
},
|
|
5205
|
+
{
|
|
5206
|
+
"name": "builtinMinimum",
|
|
5207
|
+
"tags": [
|
|
5208
|
+
{
|
|
5209
|
+
"text": "false",
|
|
5210
|
+
"name": "default"
|
|
5211
|
+
},
|
|
5212
|
+
{
|
|
5213
|
+
"text": "8.54.0",
|
|
5214
|
+
"name": "since"
|
|
5215
|
+
}
|
|
5216
|
+
],
|
|
5217
|
+
"docs": "Refuse to download or install a bundle whose version is lower than the native app version\n(`version` config override, else `CFBundleShortVersionString` / `versionName`). This is the on-device\ncounterpart of the Capgo channel setting \"disable auto update under native\" and protects against a\nreplayed old update response rolling the app back below its store version. Only the numeric\n`major.minor.patch` part is compared (a `1.2.3-beta.1` bundle is accepted on native `1.2.3`), and\nversions that do not parse as semver skip the check. Rejections are reported as the\n`version_below_native` stat. Keep it off if you version web bundles independently of the native app\n(for example native `2.0.0` with bundle `1.4.7`).\n\nFuture-major default candidate: `true`.\n\nOnly available for Android and iOS.",
|
|
5186
5218
|
"complexTypes": [],
|
|
5187
5219
|
"type": "boolean | undefined"
|
|
5188
5220
|
},
|
|
@@ -120,7 +120,14 @@ declare module '@capacitor/cli' {
|
|
|
120
120
|
*/
|
|
121
121
|
statsUrl?: string;
|
|
122
122
|
/**
|
|
123
|
-
* Configure the public key for end to end live update encryption Version 2
|
|
123
|
+
* Configure the public key for end to end live update encryption Version 2.
|
|
124
|
+
*
|
|
125
|
+
* What it guarantees: a bundle can only be installed when its checksum and session key were produced with
|
|
126
|
+
* the matching private key. Capgo never holds that key, so Capgo cannot create, modify or decrypt an update
|
|
127
|
+
* for your app. It does NOT make the bundle unreadable to someone who has your app binary: the public key
|
|
128
|
+
* ships inside the app, and anyone holding the app can recover the session key and read the bundle. If you
|
|
129
|
+
* also need Capgo to be unable to find your app (and so its public key), use a Capgo app id that is not your
|
|
130
|
+
* store bundle id (`appId` in this plugin config) so the app is not identifiable from the dashboard.
|
|
124
131
|
*
|
|
125
132
|
* Only available for Android and iOS.
|
|
126
133
|
*
|
|
@@ -275,7 +282,9 @@ declare module '@capacitor/cli' {
|
|
|
275
282
|
*
|
|
276
283
|
* Blocked by default so a redirect can never downgrade updater traffic to an unencrypted connection.
|
|
277
284
|
* Only enable this if your self-hosted update server or CDN must redirect to an HTTP URL.
|
|
278
|
-
*
|
|
285
|
+
* `httpsOnly` (default `true`) rejects every non-https URL and redirect hop regardless of this setting, so an
|
|
286
|
+
* HTTP redirect also needs `httpsOnly: false`. Direct HTTP URLs (for example `localApi` during development) are
|
|
287
|
+
* only allowed with `httpsOnly: false` as well.
|
|
279
288
|
*
|
|
280
289
|
* Only available for Android and iOS.
|
|
281
290
|
*
|
|
@@ -283,6 +292,41 @@ declare module '@capacitor/cli' {
|
|
|
283
292
|
* @since 8.52.0
|
|
284
293
|
*/
|
|
285
294
|
allowHttpsToHttpRedirect?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Require https for every URL the plugin talks to: `updateUrl`, `statsUrl`, `channelUrl` (from config,
|
|
297
|
+
* persisted values and `setUpdateUrl` / `setStatsUrl` / `setChannelUrl`), bundle zip URLs, every manifest
|
|
298
|
+
* `download_url`, preview payload URLs and every redirect hop. When enabled it overrides
|
|
299
|
+
* `allowHttpsToHttpRedirect`. A non-https URL fails the call or download with
|
|
300
|
+
* `httpsOnly is enabled and <url> is not https`.
|
|
301
|
+
*
|
|
302
|
+
* Set to `false` only for local development servers (for example a plain-http `localApi` on loopback) or a
|
|
303
|
+
* self-hosted plain-http update server you control. Upgrading with a plain-http `updateUrl`, `statsUrl`,
|
|
304
|
+
* `channelUrl` or `allowHttpsToHttpRedirect: true` requires setting this to `false` explicitly.
|
|
305
|
+
*
|
|
306
|
+
* Only available for Android and iOS.
|
|
307
|
+
*
|
|
308
|
+
* @default true
|
|
309
|
+
* @since 8.54.0
|
|
310
|
+
*/
|
|
311
|
+
httpsOnly?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Refuse to download or install a bundle whose version is lower than the native app version
|
|
314
|
+
* (`version` config override, else `CFBundleShortVersionString` / `versionName`). This is the on-device
|
|
315
|
+
* counterpart of the Capgo channel setting "disable auto update under native" and protects against a
|
|
316
|
+
* replayed old update response rolling the app back below its store version. Only the numeric
|
|
317
|
+
* `major.minor.patch` part is compared (a `1.2.3-beta.1` bundle is accepted on native `1.2.3`), and
|
|
318
|
+
* versions that do not parse as semver skip the check. Rejections are reported as the
|
|
319
|
+
* `version_below_native` stat. Keep it off if you version web bundles independently of the native app
|
|
320
|
+
* (for example native `2.0.0` with bundle `1.4.7`).
|
|
321
|
+
*
|
|
322
|
+
* Future-major default candidate: `true`.
|
|
323
|
+
*
|
|
324
|
+
* Only available for Android and iOS.
|
|
325
|
+
*
|
|
326
|
+
* @default false
|
|
327
|
+
* @since 8.54.0
|
|
328
|
+
*/
|
|
329
|
+
builtinMinimum?: boolean;
|
|
286
330
|
/**
|
|
287
331
|
* Allow the plugin to modify the appId dynamically from the JavaScript side.
|
|
288
332
|
*
|