Files
Brandon LiandClaude Opus 5 3cc7ddcc5c Add scrollToLoad and an absent variant of waitFor
scrollToLoad walks a progressively-loading list to the bottom before the steps
that act on its items run. Stopping is two-part: no new matches appeared AND the
container was already pinned to the bottom — counting alone stops early on a slow
fetch. Hitting the scroll cap is reported rather than passed off as done, so a
later step never works quietly on a partial list.

The scrolling element is usually not the window. Lists like this live in a div
with its own overflow, and scrolling the document does nothing at all, so the
step walks up from a matched item to the ancestor that actually scrolls —
overflow allows it and there is more content than fits — with containerSelector
to name one outright when the guess is wrong. Verified against a page whose
document also scrolls, which is the case that tells the two apart: it found the
inner div and pulled 12 items up to 60 in 7 scrolls.

waitFor gains `absent`, for waiting on something to go rather than arrive — a
modal closing after a reset. It only accepts a genuine "selector matched
nothing"; an unreachable extension looks the same from a distance and would
otherwise satisfy the gate for the wrong reason, sending the next iteration into
a page that still has the modal open.

The locate queue carries a free-form options blob now, so a new kind of request
stops meaning a new column each time.

Also fixes a missing comma in the reset flow that broke the build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 14:31:36 -05:00
..

AutoFirmer Capture (Chromium extension)

Polls the dashboard for an on/off flag and, while it's on, scrapes the target tab's HTML and posts it back to the dashboard.

Install (unpacked)

  1. Start the dashboard (npm run dev) so http://localhost:3000 is up.
  2. Open chrome://extensions, enable Developer mode (top right).
  3. Load unpacked → select this extension/ folder.
  4. Click the extension icon to open the popup and set:
    • Dashboard URL — default http://localhost:3000. Use the VPS IP if the dashboard runs elsewhere.
    • Poll interval — seconds between status checks (default 3).
    • Target URL pattern — a Chrome match pattern like https://*.tradovate.com/*. Leave blank to capture whichever tab is active.
    • Element selector — optional CSS selector; matching elements get their on-screen position measured alongside the HTML.

The badge shows ON (green) while capturing, ! (red) if the dashboard is unreachable, and nothing when the switch is off.

Flow

AutoBuyer page  --PATCH /api/autobuyer/status-->  SQLite settings
extension       --GET   /api/autobuyer/status-->  { enabled }
extension       --POST  /api/autobuyer/capture->  html + viewport + element rects
AutoBuyer page  --GET   /api/autobuyer/capture->  renders the HTML

Scope

host_permissions is deliberately narrow — https://*.tradeify.co/* plus localhost for the dashboard. The extension is technically incapable of reading any other site, so an accidental capture of your bank or mail tab can't happen. The default Target URL pattern matches, so it only ever captures the broker tab regardless of which tab is focused.

To automate a different broker, add its pattern to host_permissions in manifest.json, update the popup's target pattern, and reload the extension. Avoid going back to <all_urls> — that re-enables scraping whatever tab is active.

Notes

  • The extension never captures the dashboard's own pages — otherwise it would just mirror its own output back.
  • chrome://, about: and Web Store pages cannot be scripted by any extension; they're skipped.
  • MV3 service workers are torn down when idle. Each poll makes an extension API call, which keeps the worker alive; a 30-second alarm revives it if Chrome kills it anyway. So worst-case cadence is 30s, normal cadence is the poll interval.