Prove cookie injection lands, rather than assuming it

setCookie is fire-and-forget, so the import's count was what WebKit was
handed, not what it kept. A probe from inside the page reads back the
other end: pairing against Arc gave `names=tz,cids,frontend_lang` for
aputure.odoo.com, and `tz` exists only in Arc's store — so the import
demonstrably landed.

The sites still ask for sign-in. That is the far end refusing the
session, not a broken import, and the two are now distinguishable
instead of being guessed at.
This commit is contained in:
2026-09-01 12:21:41 +02:00
parent ff4a0c6bc4
commit f057268103
5 changed files with 70 additions and 3 deletions
+2
View File
@@ -46,3 +46,5 @@ export const pairBrowser = (browser: string) =>
export const testNotification = (appId: string) =>
invoke<void>("test_notification", { appId });
export const notificationStatus = () => invoke<string>("notification_status");
export const probeCookies = (appId: string) => invoke<void>("probe_cookies", { appId });
export const cookieProbe = () => invoke<string>("cookie_probe");
+19
View File
@@ -46,6 +46,7 @@ export default function Settings({
const [browser, setBrowser] = useState("");
const [pairing, setPairing] = useState(false);
const [notifyStatus, setNotifyStatus] = useState<string | null>(null);
const [cookieStatus, setCookieStatus] = useState<string | null>(null);
const [paired, setPaired] = useState<PairResult | null>(null);
const groups = [...config.groups].sort((a, b) => a.order - b.order);
@@ -263,11 +264,29 @@ export default function Settings({
))}
</select>
</label>
<button
onClick={async () => {
if (!activeId) return;
setCookieStatus("checking…");
await api.probeCookies(activeId);
await new Promise((r) => setTimeout(r, 400));
setCookieStatus(await api.cookieProbe());
}}
disabled={!activeId}
title="What the current app can actually see"
className={BTN}
>
Check cookies
</button>
<button onClick={pair} disabled={pairing || !browser} className={BTN_PRIMARY}>
{pairing ? <Spinner /> : config.settings.lastPairedAt ? "Pair again" : "Pair"}
</button>
</div>
{cookieStatus && (
<p className={`${HELP} font-mono`}>{cookieStatus}</p>
)}
{config.settings.lastPairedAt && !paired && (
<p className={HELP}>Last paired {config.settings.lastPairedAt}.</p>
)}