Preserve explicit App approval, expose playback and transfer progress, and keep shared identity and native window presentation coherent. Retain terminal fallback, cancel external input safely, and reject withdrawn UDP preparation before adoption. Reuse exact Web artifacts across matched targets and extend the existing text participant with typed history, replies and reactions. Verified Rust/WASM/protocol checks, 1614 Web tests, Windows capture compilation and five external input lifecycle tests.
17 lines
945 B
JavaScript
17 lines
945 B
JavaScript
import assert from "node:assert/strict";
|
|
|
|
// Vite can place shared build metadata in an eagerly loaded dependency. Check
|
|
// the modules named by the served HTML, not an unrelated file in the image.
|
|
export function webSourceAssets(html) {
|
|
const main = html.match(/<script\b[^>]*\bsrc="((?:\.?\/)?assets\/index-[A-Za-z0-9_-]+\.js)"/)?.[1];
|
|
assert.ok(main, "Package must serve the Web UI");
|
|
const preloads = [...html.matchAll(/<link\b[^>]*\brel="modulepreload"[^>]*\bhref="((?:\.?\/)?assets\/[A-Za-z0-9_-]+\.js)"/g)]
|
|
.map(match => match[1]);
|
|
return [...new Set([main, ...preloads].map(asset => new URL(asset, "http://piik.invalid/").pathname))];
|
|
}
|
|
|
|
export async function checkWebSourceIdentity(html, revision, readScript) {
|
|
const scripts = await Promise.all(webSourceAssets(html).map(asset => readScript(asset)));
|
|
assert.ok(scripts.some(script => script.includes(revision)), "Web and runtime must have the same source identity");
|
|
}
|