Something went wrong. Try again.
this post sux
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667/* BiDi probe #7 — record every URL that passes through window.fetch while the app paginates the feed; compare against what performance actually loads. */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 = 25000) { 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 val(expression) { try { const r = await send("script.evaluate", { expression, target: { context: ctx.context }, awaitPromise: true, resultOwnership: "none" }, sessionId); if (!r || !r.result) return "NO-RESULT"; return "value" in r.result ? String(r.result.value) : JSON.stringify(r.result); } catch (e) { return "ERR:" + e.message; }}
console.log("live fetch is sux wrapper:", await val(`String(window.fetch.toString().includes("matchedMethod"))`));console.log("arm:", await val(`(() => { window.__calls = []; const of = window.fetch; window.fetch = function (input, init) { try { const u = typeof input === "string" ? input : (input && input.url) || ""; window.__calls.push(u.split("?")[0]); } catch (e) { window.__calls.push("err:" + e.message); } return of.apply(this, arguments); }; return "armed, chainedToSux=" + of.toString().includes("matchedMethod");})()`));
for (let i = 0; i < 6; i++) { await val(`window.scrollTo(0, document.body.scrollHeight); "ok"`); await sleep(2500);}await sleep(5000);
console.log("calls through window.fetch (unique):");console.log(await val(`JSON.stringify([...new Set(window.__calls)])`));console.log("performance xrpc fetches (unique, since load):");console.log(await val(`JSON.stringify([...new Set(performance.getEntriesByType("resource").map(r => r.name).filter(n => n.includes("/xrpc/")).map(n => n.split("?")[0]))])`));console.log("live fetch is now probe wrapper:", await val(`String(window.fetch.toString().slice(0, 60))`));try { await send("session.end", {}, sessionId, 5000); } catch {}ws.close();process.exit(0);