Builds the pipeline the autobuyer needs: see the page, find an element, click it. extension/ — MV3 Chromium extension. Polls /api/autobuyer/status and, while on, scrapes the target tab's HTML and posts it back. Also serves locate requests: focuses the window, scrolls the element into view, and reports its position. host_permissions is scoped to tradeify plus localhost so it cannot read other sites — an empty target pattern would otherwise capture whatever tab happened to be active, including banking or mail. app/api/autobuyer/ — status toggle, capture store, and the locate request queue. CORS is open because the extension's origin changes every time an unpacked extension is reloaded. app/autobuyer/page.tsx — ON switch, source view (default) and a rendered view. The render uses sandbox="allow-scripts" without allow-same-origin: the page's own JS is needed because sites ship content at opacity:0 and fade it in, but the frame must not reach the dashboard's same-origin API routes, which serve firm credentials. clicker/ — Python CLI. Asks the extension where a selector is, adds the element rect to the window's screen position and the browser chrome height to get desktop coordinates, then clicks with a human motion model (curved path, eased velocity, occasional overshoot, dwell before press). Raises the browser application first, since macOS consumes a click on an unfocused window rather than delivering it. Refuses to click when the element is covered by an overlay, when the coordinates fall off-screen, or when the browser cannot be confirmed frontmost. Verified: API round-trips, capture pruning, locate claim-once semantics, motion geometry and timing, and focus activation — the last two against stubs, since pyautogui and pyobjc are not installed here. NOT verified end to end: Chrome is still running a stale build of the extension, so a locate request has never completed against a real page and no real click has been sent. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
42 lines
1.9 KiB
HTML
42 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<style>
|
|
body { width: 300px; margin: 0; padding: 14px; font: 13px/1.4 system-ui, sans-serif; color: #1e293b; }
|
|
h1 { font-size: 14px; margin: 0 0 10px; }
|
|
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin: 10px 0 3px; }
|
|
input { width: 100%; box-sizing: border-box; padding: 5px 7px; font: 12px ui-monospace, monospace;
|
|
border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; }
|
|
button { margin-top: 12px; padding: 6px 10px; font-size: 12px; font-weight: 500; border: 0;
|
|
border-radius: 6px; background: #3b82f6; color: #fff; cursor: pointer; }
|
|
button.ghost { background: #e2e8f0; color: #334155; margin-left: 6px; }
|
|
#status { margin-bottom: 10px; padding: 8px; border-radius: 6px; background: #f1f5f9; font-size: 12px; }
|
|
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
|
|
.muted { color: #64748b; font-size: 11px; }
|
|
.err { color: #dc2626; font-size: 11px; margin-top: 4px; word-break: break-word; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>AutoFirmer Capture</h1>
|
|
<div id="status"></div>
|
|
|
|
<label for="apiBase">Dashboard URL</label>
|
|
<input id="apiBase" placeholder="http://localhost:3000" />
|
|
|
|
<label for="pollSeconds">Poll interval (seconds)</label>
|
|
<input id="pollSeconds" type="number" min="1" max="120" />
|
|
|
|
<label for="targetUrlPattern">Target URL pattern (blank = active tab)</label>
|
|
<input id="targetUrlPattern" placeholder="https://*.tradeify.co/*" />
|
|
|
|
<label for="elementSelector">Element selector (optional)</label>
|
|
<input id="elementSelector" placeholder="button.buy" />
|
|
|
|
<button id="save">Save</button>
|
|
<button id="now" class="ghost">Capture now</button>
|
|
|
|
<script src="popup.js"></script>
|
|
</body>
|
|
</html>
|