fix(browser): retain attached scenario emulation until cleanup

This commit is contained in:
dakjdakd
2026-10-10 01:45:00 +08:00
committed by morluto
parent 5e8fb531e2
commit a0523b375e
5 changed files with 240 additions and 16 deletions
@@ -11,6 +11,20 @@ export async function startBrowserVerifierSite() {
response.destroy();
return;
}
if (request.url === "/scenario-environment") {
response.setHeader("content-type", "text/html");
response.end(`<!doctype html><html><body><pre id="environment"></pre>
<button id="refresh-environment">Refresh environment</button><script>
const refresh = () => document.querySelector('#environment').textContent = JSON.stringify({
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
locale: Intl.DateTimeFormat().resolvedOptions().locale,
dpr: devicePixelRatio, width: innerWidth, height: innerHeight
});
document.querySelector('#refresh-environment').onclick = refresh;
refresh();
</script></body></html>`);
return;
}
if (request.url === "/slow-json") {
response.setHeader("content-type", "application/json");
response.write('{"pending":');