Skip to content

Add remove-from-cart, a cookie-login helper, and stop rotated cookie files escaping .gitignore#11

Open
vyakunin wants to merge 1 commit into
rigwild:mainfrom
vyakunin:fix/local-patches
Open

Add remove-from-cart, a cookie-login helper, and stop rotated cookie files escaping .gitignore#11
vyakunin wants to merge 1 commit into
rigwild:mainfrom
vyakunin:fix/local-patches

Conversation

@vyakunin

Copy link
Copy Markdown

Three independent changes; happy to split if you prefer separate PRs.

1. remove-from-cart

Today the only removal tool is clear-cart, so swapping one item means wiping the cart and re-adding everything. This adds remove-from-cart, which drops a single item by ASIN and leaves the rest untouched. Test included.

2. login_and_save_cookies.cjs

A visible Puppeteer login that writes amazonCookies.json, so first-time setup does not mean hand-copying cookies out of devtools. Credentials come from AMAZON_EMAIL / AMAZON_PASSWORD in the environment — nothing is written to disk except the cookie file the server already expects.

3. .gitignore — the one worth reviewing

The existing rule is the bare filename:

amazonCookies.json

Any rotated or backup copy — amazonCookies.json.bak, amazonCookies.json.bak.20260621_164507 — is therefore untracked but not ignored. Those files hold live session-token / at-main / sess-at-* values, i.e. a working Amazon session. A single git add -A commits it.

That is easy to hit, since taking a backup before a re-login is the natural thing to do. Widened to cover the .bak variants. amazonCookies.example.json stays tracked.

…ignore

- remove-from-cart: drop a single item by ASIN instead of only clear-cart, so a
  swap doesn't wipe unrelated cart items. Test included.
- login_and_save_cookies.cjs: visible Puppeteer login that writes amazonCookies
  .json; reads AMAZON_EMAIL / AMAZON_PASSWORD from the environment.
- .gitignore: the rule was the bare filename `amazonCookies.json`, so rotated
  copies (`amazonCookies.json.bak.<ts>`) were untracked but NOT ignored. Those
  hold live session-token / at-main auth cookies, so a `git add -A` would commit
  a working Amazon session. Ignore the .bak variants too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant