Something went wrong. Try again.
this post sux
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445/* BiDi probe #3 — raw result diagnostics. */const ws = new WebSocket("ws://localhost:9222/session");let seq = 0;const pending = new Map();const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function send(method, params = {}, sessionId = null, timeoutMs = 20000) { const id = ++seq; const msg = { id, method, params }; if (sessionId) msg.sessionId = sessionId; ws.send(JSON.stringify(msg)); return new Promise((resolve, reject) => { const t = setTimeout(() => { pending.delete(id); reject(new Error("timeout " + method)); }, timeoutMs); pending.set(id, { resolve, reject, t }); });}await new Promise((res, rej) => { ws.onopen = res; ws.onerror = () => rej(new Error("no ws")); });ws.onmessage = (ev) => { const m = JSON.parse(ev.data); if (m.id && pending.has(m.id)) { const p = pending.get(m.id); pending.delete(m.id); clearTimeout(p.t); m.type === "success" ? p.resolve(m.result) : p.reject(new Error(JSON.stringify(m.error))); }};
const { sessionId } = await send("session.new", { capabilities: {} });const tree = await send("browsingContext.getTree", {}, sessionId);const ctx = tree.contexts.find((c) => (c.url || "").includes("bsky.app"));
async function raw(expression) { const r = await send("script.evaluate", { expression, target: { context: ctx.context }, awaitPromise: true, resultOwnership: "none" }, sessionId); return r.result;}
console.log("1+1 =>", JSON.stringify(await raw("1+1")));console.log("typeof __fp =>", JSON.stringify(await raw("typeof window.__fp")));console.log("__fp =>", JSON.stringify(await raw("window.__fp")));console.log("typeof __suxDiag =>", JSON.stringify(await raw("typeof window.__suxDiag")));console.log("diag.seen =>", JSON.stringify(await raw("window.__suxDiag && window.__suxDiag.seen")));console.log("iife+stringify =>", JSON.stringify(await raw("JSON.stringify((() => { return {a: 1}; })())")));console.log("counters =>", JSON.stringify(await raw("JSON.stringify((() => { return { fp: window.__fp, xhr: window.__xhr, seen: window.__suxDiag ? window.__suxDiag.seen : null }; })())")));try { await send("session.end", {}, sessionId, 5000); } catch {}ws.close();process.exit(0);