Add session mode: signing in and adding to the cart.

With cart_mode = "session", dibs signs in to the shop's account and puts
an item in the cart when it fires. The account's cookies are kept apart
from the watcher's and stored encrypted, with the key in the OS keyring.
Without a keyring, they're stored in a file only you can read.

An alert now goes out right away, without a cart link, and a second one
follows once the item is in the cart. If adding fails, the second alert
carries the cart link instead.

Amazon only accepts additions its page scripts have seen, so plugins can
now press a button in headless Chrome with ctx:click.

The TUI asks for one-time codes and shows the plugin's warning about
account locks in a modal. 'dibs login' signs in from a terminal, or
with --browser in a Chrome window, and 'dibs logout' deletes the cookies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
OverlordandClaude Bot committed 2026-10-14 17:26:26 +02:00
1 parent e2cbc1a55c
commit 15a34e1f84
39 files changed
+3529 -163

No files matched your search

+15
View File
@@ -35,10 +35,25 @@ type Alert struct {
// during the cooldown because the price dropped below it.
PreviousPrice *float64
PreviousCurrency string
// Cart is what session mode did about the cart, in the order the
// notifications go out: CartAdding, then CartAdded or CartFailed. It is
// "" without session mode.
Cart string
// CartURL is the cart page, once the item is in the cart.
CartURL string
// CartError says why adding to the cart failed.
CartError string
// Test marks the sample alert of `dibs notify test`.
Test bool
}
// The cart steps of session mode.
const (
CartAdding = "adding"
CartAdded = "added"
CartFailed = "failed"
)
// PriceText is the price as notifications show it, such as "129.99 EUR" or
// "149.99 USD (≈ 133.95 EUR)".
func (a Alert) PriceText() string {