/** * Auto-pair with dylive web: when user is logged into /x (or any dylive page), * pull ingest token + origin and hand to the service worker. No manual paste. */ (async () => { try { const origin = location.origin; const res = await fetch(`${origin}/api/x2/status`, { credentials: "include", headers: { Accept: "application/json" }, }); if (!res.ok) return; const data = await res.json(); const token = String(data?.ingest_token || "").trim(); if (!token) return; chrome.runtime.sendMessage({ type: "DYLIVE_X_AUTO_PAIR", origin, token, ingestUrl: `${origin}/api/x2/ingest`, pollUrl: `${origin}/api/x2/extension/poll`, wsUrl: `${origin.replace(/^http/i, "ws")}/api/x2/extension/ws`, }); } catch { /* not logged in / offline */ } })();