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:
Overlord committed 2026-10-14 14:08:56 +02:00
1 parent f2ea1297e8
commit e2cbc1a55c
20 files changed
+905 -73

No files matched your search

+36 -11
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"net/url"
"runtime"
"strconv"
"strings"
http "github.com/bogdanfinn/fhttp"
@@ -83,24 +84,48 @@ func (b Browser) navigationHeaders(u *url.URL) http.Header {
}
}
// secCHUA builds Chrome's sec-ch-ua brand list. Chrome derives the GREASE
// brand and the brand order from its major version (GenerateBrandVersionList
// in Chromium's user_agent_utils.cc), so a fixed string would stand out after
// an update.
func secCHUA(major int) string {
// Brand is one entry of Chrome's brand list, which sec-ch-ua and
// navigator.userAgentData report.
type Brand struct {
Name string
Version string
}
// Brands is Chrome's brand list. Chrome derives the GREASE brand and the
// brand order from its major version (GenerateBrandVersionList in
// Chromium's user_agent_utils.cc), so a fixed list would stand out after an
// update.
func (b Browser) Brands() []Brand {
return brands(b.Major)
}
func brands(major int) []Brand {
chars := []string{" ", "(", ":", "-", ".", "/", ")", ";", "=", "?", "_"}
versions := []string{"8", "99", "24"}
orders := [][3]int{{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}
grease := fmt.Sprintf(`"Not%sA%sBrand";v="%s"`, chars[major%len(chars)], chars[(major+1)%len(chars)], versions[major%len(versions)])
grease := Brand{"Not" + chars[major%len(chars)] + "A" + chars[(major+1)%len(chars)] + "Brand", versions[major%len(versions)]}
order := orders[major%len(orders)]
var brands [3]string
brands[order[0]] = grease
brands[order[1]] = fmt.Sprintf(`"Chromium";v="%d"`, major)
brands[order[2]] = fmt.Sprintf(`"Google Chrome";v="%d"`, major)
var out [3]Brand
out[order[0]] = grease
out[order[1]] = Brand{"Chromium", strconv.Itoa(major)}
out[order[2]] = Brand{"Google Chrome", strconv.Itoa(major)}
return strings.Join(brands[:], ", ")
return out[:]
}
func secCHUA(major int) string {
var parts []string
for _, b := range brands(major) { parts = append(parts, fmt.Sprintf(`"%s";v="%s"`, b.Name, b.Version)) }
return strings.Join(parts, ", ")
}
// AcceptLanguage is the Accept-Language a local shopper's browser would
// send to host.
func AcceptLanguage(host string) string {
return acceptLanguage(host)
}
// languages maps a public suffix to the Accept-Language a local shopper's