@imagina-build/ias-cli 0.2.0 → 0.2.1
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/package.json +1 -1
- package/src/commands/update/index.mjs +7 -1
- package/src/config.mjs +2 -2
- package/src/ota.mjs +4 -3
package/package.json
CHANGED
|
@@ -387,6 +387,12 @@ export async function check(settings, { platforms = PLATFORMS }, output) {
|
|
|
387
387
|
return { checks };
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
/**
|
|
391
|
+
* The URL of a file the manifest points to, asked of the server this publication went to: a manifest may name any of
|
|
392
|
+
* the hosts the server answers for (the old domain, the new one), and they all serve the same path.
|
|
393
|
+
*/
|
|
394
|
+
const assetOf = (url, settings) => new URL(new URL(url, settings.manifestUrl).pathname, settings.base);
|
|
395
|
+
|
|
390
396
|
/**
|
|
391
397
|
* Asks for the manifest as a phone would and checks the signature, the id and every file it points to. `checked`
|
|
392
398
|
* holds the files already checked in this run (one per settings): the platforms share most of them. `channel` and
|
|
@@ -418,7 +424,7 @@ export async function checkServed(settings, platform, runtime, expectedId, outpu
|
|
|
418
424
|
checked.add(asset.hash);
|
|
419
425
|
// Each file once, and the bundle also without gzip.
|
|
420
426
|
for (const encoding of index === 0 ? [undefined, 'identity'] : [undefined]) {
|
|
421
|
-
const answer = await download(
|
|
427
|
+
const answer = await download(assetOf(asset.url, settings), encoding ? { 'accept-encoding': encoding } : {}, output);
|
|
422
428
|
if (!answer.ok) throw new Error(`${platform}: ${asset.url} answered ${answer.status}`);
|
|
423
429
|
if (sha256(Buffer.from(await answer.arrayBuffer())) !== asset.hash) throw new Error(`${platform}: ${asset.url} does not match its hash`);
|
|
424
430
|
}
|
package/src/config.mjs
CHANGED
|
@@ -163,7 +163,7 @@ function iasUpdateSettings({ dir, config }, env) {
|
|
|
163
163
|
manifestUrl: manifestUrl.href,
|
|
164
164
|
base,
|
|
165
165
|
project: manifestUrl.pathname.match(MANIFEST_PATH)[1],
|
|
166
|
-
assetPath: `${
|
|
166
|
+
assetPath: `${base}/assets/`,
|
|
167
167
|
keyid,
|
|
168
168
|
certificate: new X509Certificate(readFileSync(certificateFile)),
|
|
169
169
|
signingSource: appCertificate ? 'app.json' : 'updates.signing of ias.json',
|
|
@@ -203,7 +203,7 @@ function legacyUpdateSettings(projectDir, env) {
|
|
|
203
203
|
manifestUrl: manifestUrl.href,
|
|
204
204
|
base,
|
|
205
205
|
project: manifestUrl.pathname.match(MANIFEST_PATH)[1],
|
|
206
|
-
assetPath: `${
|
|
206
|
+
assetPath: `${base}/assets/`,
|
|
207
207
|
keyid: updates.codeSigningMetadata.keyid,
|
|
208
208
|
certificate,
|
|
209
209
|
privateKey,
|
package/src/ota.mjs
CHANGED
|
@@ -30,9 +30,10 @@ export function readEnvFile(path, names) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* One manifest per platform from an expo export folder: the same createdAt, the runtime of each platform,
|
|
34
|
-
* asset URLs
|
|
35
|
-
*
|
|
33
|
+
* One manifest per platform from an expo export folder: the same createdAt, the runtime of each platform, absolute
|
|
34
|
+
* asset URLs (the released expo-updates clients do not resolve relative ones), metadata {} (filters could make phones
|
|
35
|
+
* load an older update) and the public config as extra.expoClient. Returns the manifests and the files to upload, by
|
|
36
|
+
* hash. Throws if a bundle lacks a value it must carry.
|
|
36
37
|
*/
|
|
37
38
|
export function buildManifests({ dist, metadata, platforms, runtimes, expoClient, assetPath, createdAt, mustContain = [] }) {
|
|
38
39
|
const files = new Map();
|