// Dev harness — exercise Theseus's `s3` content path (serveBns) WITHOUT Electron.
// Faithfully replicates what the browser triggers for a Sia site: resolve the
// name, fetch the index through the public gateway exactly as serveBns does,
// strip the gateway's , then fetch every referenced same-origin asset the
// same way and report which load. This is the headless version of manual test
// #2 (Sia-via-gateway rendering).
//
// Usage: node dev/probe-site.mjs e.g. coinspectrum.deviant.bch
import WebSocket from "ws";
import { resolveName } from "../../Argus/src/lib/resolver-web.js";
const GATEWAY = "https://navigate.st"; // must match main.js
const host = (process.argv[2] || "coinspectrum.deviant.bch").toLowerCase();
// mirror of serveBns's s3 fetch for one request path
async function gw(reqPath) {
const r = await fetch(`${GATEWAY}/bns/${host}${reqPath}`);
const ct = r.headers.get("content-type") || "";
const buf = Buffer.from(await r.arrayBuffer());
return { status: r.status, ct, buf };
}
const stripBase = (html) => html.replace(//i, "");
// same-origin STATIC asset refs a browser would request from bns://host/.
// Strip