Patched it for some apple devices pretending to be chromium

This commit is contained in:
Tracker-Friendly 2025-02-05 16:32:08 +00:00
parent f5b3297d9d
commit c55ae178b4
1 changed files with 6 additions and 3 deletions

View File

@ -655,7 +655,8 @@ func Get(url string) (response *Response, err error) {
if err != nil {
return
}
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
// Disable if not https, we don't detect chromium, or we are on safari
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
request.DisableStreamedClient = true
}
response, err = Fetch.Do(request)
@ -671,7 +672,8 @@ func Post(url string, contentType string, body io.Reader) (response *Response, e
if err != nil {
return
}
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
// Disable if not https, we don't detect chromium, or we are on safari
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
request.DisableStreamedClient = true
}
request.Header.Add("Content-Type", contentType)
@ -690,7 +692,8 @@ func PostForm(url string, data url.Values) (response *Response, err error) {
return
}
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
// Disable if not https, we don't detect chromium, or we are on safari
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
request.DisableStreamedClient = true
}
response, err = Fetch.Do(request)