Replace Chrome-remote-debugging login capture with a cookie-paste import flow
All checks were successful
Deploy / deploy (push) Successful in 25s

Live testing showed the CDP approach still fails hCaptcha even with a
real human clicking through chrome://inspect: the headless Chromium's
own fingerprint (HeadlessChrome user-agent, navigator.webdriver=true)
is what gets flagged, independent of who's driving it. Trying to
disguise that browser to get past bot detection would be captcha
evasion, not a session-handling technique, so that path is dropped
entirely rather than patched further.

New flow: log into MassPrice with an ordinary, non-automated browser
(hCaptcha passes normally), export the session's cookies with a
extension, and paste them into the Session page. import_cookies()
converts the export into Playwright's storage_state shape and verifies
it actually authenticates against the live site before saving it,
so a bad paste never clobbers a working session. This also removes the
now-unnecessary socat proxy / debug port exposure — Chromium's own
CDP port was only ever needed for the dropped approach.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H6TgffxTvYhqxykAbVQg2v
This commit is contained in:
Barely Removable 2026-08-31 20:10:51 -07:00
parent bec399dd11
commit 48d8bac332
10 changed files with 214 additions and 311 deletions

View file

@ -178,9 +178,22 @@ footer {
.panel-narrow { max-width: 560px; }
.session-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.session-steps code { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.session-steps a { color: var(--accent); }
.session-actions { display: flex; gap: 8px; margin-top: 16px; }
.cookie-textarea {
width: 100%;
margin-top: 12px;
background: var(--panel-alt);
border: 1px solid var(--border);
color: var(--text);
border-radius: 6px;
padding: 10px;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.8rem;
resize: vertical;
}
.activity-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.activity-table th, .activity-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.activity-table th { color: var(--text-dim); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; }

View file

@ -25,34 +25,31 @@ document.addEventListener("DOMContentLoaded", () => {
});
function initSessionControls() {
const startBtn = document.getElementById("session-start");
const captureBtn = document.getElementById("session-capture");
const stopBtn = document.getElementById("session-stop");
if (!startBtn) return; // not on the Session page
const importBtn = document.getElementById("session-import");
const textarea = document.getElementById("cookie-paste");
if (!importBtn) return; // not on the Session page
async function call(url, btn) {
btn.disabled = true;
const original = btn.textContent;
btn.textContent = "Working…";
importBtn.addEventListener("click", async () => {
const original = importBtn.textContent;
importBtn.disabled = true;
importBtn.textContent = "Verifying…";
try {
const res = await fetch(url, { method: "POST" });
const res = await fetch("/api/session/import", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ cookies: textarea.value }),
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
alert(data.error || "Request failed");
btn.disabled = false;
btn.textContent = original;
alert(data.error || "Import failed");
return;
}
window.location.reload();
} catch (err) {
btn.disabled = false;
btn.textContent = original;
} finally {
importBtn.disabled = false;
importBtn.textContent = original;
}
}
startBtn.addEventListener("click", () => call("/api/session/start", startBtn));
captureBtn.addEventListener("click", () => call("/api/session/capture", captureBtn));
stopBtn.addEventListener("click", () => call("/api/session/stop", stopBtn));
});
}
function initRuleCard(card) {