Add the Chrome fallback and the needs-human flow.
Bot checks escalate to headless Chrome with stealth, which claims the same identity as tls-client and hands its cookies back to the jar. The visit counts against the rate limits. If Chrome can't clear a check, the URL is marked needs-human. Pressing Enter on it in the TUI, or running 'dibs solve', opens a visible window; dibs carries on once the page loads. Processes now merge the cookie file on save, with the newest cookie winning.
This commit is contained in:
1 parent
f2ea1297e8
commit
e2cbc1a55c
20 files changed
+905
-73
No files matched your search
+19
-6
@@ -295,7 +295,7 @@ func RecordOutcome(l *ratelimit.Limiter, host string, resp *fetch.Response, err
|
||||
return 0
|
||||
case err != nil:
|
||||
return l.Failure(host)
|
||||
case resp.Verdict == fetch.Challenge || resp.Verdict == fetch.Blocked || resp.Verdict == fetch.HTTPError:
|
||||
case resp.Verdict == fetch.Challenge || resp.Verdict == fetch.NeedsHuman || resp.Verdict == fetch.Blocked || resp.Verdict == fetch.HTTPError:
|
||||
return l.Failure(host)
|
||||
default:
|
||||
l.Success(host)
|
||||
@@ -320,16 +320,29 @@ func (s *Scheduler) PauseAll(paused bool) {
|
||||
// CheckNow moves the checks of the item called name forward, as far as the
|
||||
// URL floor allows. It reports whether there is such an item.
|
||||
func (s *Scheduler) CheckNow(name string) bool {
|
||||
found := s.each(func(t *target) bool { return t.item.Name == name }, func(t *target) {
|
||||
ready := s.limiter.URLReady(t.fetchURL)
|
||||
if now := s.clock.Now(); ready.Before(now) { ready = now }
|
||||
if ready.Before(t.next) { t.next = ready }
|
||||
})
|
||||
found := s.each(func(t *target) bool { return t.item.Name == name }, s.soon)
|
||||
s.poke()
|
||||
|
||||
return found
|
||||
}
|
||||
|
||||
// soon moves the check of t forward to the earliest time the URL floor
|
||||
// allows. Callers hold mu.
|
||||
func (s *Scheduler) soon(t *target) {
|
||||
ready := s.limiter.URLReady(t.fetchURL)
|
||||
if now := s.clock.Now(); ready.Before(now) { ready = now }
|
||||
if ready.Before(t.next) { t.next = ready }
|
||||
}
|
||||
|
||||
// CheckHost moves the checks of every URL on host forward, as far as the
|
||||
// URL floor allows.
|
||||
func (s *Scheduler) CheckHost(host string) {
|
||||
host = strings.ToLower(host)
|
||||
|
||||
s.each(func(t *target) bool { return t.host == host }, s.soon)
|
||||
s.poke()
|
||||
}
|
||||
|
||||
// Statuses returns a snapshot of every URL, in config order.
|
||||
func (s *Scheduler) Statuses() []Status {
|
||||
s.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user