NXDOMAIN
${h} is not registered on the Bitcoin Cash chain.
`;
// BNS `ip`-record fetch. The default `fetch` fails here for two reasons:
@@ -404,7 +430,7 @@ async function serve(res, name, reqPath, baseHref) {
case "h":
if (reqPath !== "/") { res.writeHead(404); return res.end("not found"); }
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
- return res.end(injectBase(r.h, baseHref));
+ return res.end(transformHtml(r.h, baseHref));
case "s3": {
const sub = subFolder(name);
let base = r.s3; if (base.endsWith("/") && sub) base += sub + "/";
@@ -442,7 +468,7 @@ async function serve(res, name, reqPath, baseHref) {
}
const buf = Buffer.from(await up.arrayBuffer());
let ct = up.headers.get("content-type"); if (!ct || ct === "application/octet-stream") ct = guess(key);
- if (ct.includes("text/html")) { res.writeHead(up.status, { "content-type": ct }); return res.end(injectBase(buf.toString("utf8"), baseHref)); }
+ if (ct.includes("text/html")) { res.writeHead(up.status, { "content-type": ct }); return res.end(transformHtml(buf.toString("utf8"), baseHref)); }
res.writeHead(up.status, { "content-type": ct }); return res.end(buf);
}
case "ip": {
@@ -464,7 +490,7 @@ async function serve(res, name, reqPath, baseHref) {
if (lk === "content-type") continue;
outHeaders[k] = v;
}
- if (ct.includes("text/html")) { res.writeHead(up.status, outHeaders); return res.end(injectBase(buf.toString("utf8"), baseHref)); }
+ if (ct.includes("text/html")) { res.writeHead(up.status, outHeaders); return res.end(transformHtml(buf.toString("utf8"), baseHref)); }
res.writeHead(up.status, outHeaders); return res.end(buf);
}
case "p": {
@@ -483,7 +509,7 @@ async function serve(res, name, reqPath, baseHref) {
if (lk === "content-type") continue;
outHeaders[k] = v;
}
- if (ct.includes("text/html")) { res.writeHead(up.status, outHeaders); return res.end(injectBase(buf.toString("utf8"), baseHref)); }
+ if (ct.includes("text/html")) { res.writeHead(up.status, outHeaders); return res.end(transformHtml(buf.toString("utf8"), baseHref)); }
res.writeHead(up.status, outHeaders); return res.end(buf);
}
case "u":