Replace Chrome-remote-debugging login capture with a cookie-paste import flow
All checks were successful
Deploy / deploy (push) Successful in 25s
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:
parent
bec399dd11
commit
48d8bac332
10 changed files with 214 additions and 311 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue