xP: fix alternative browsers on iOS

As a rule, they use the same stupid and broken WebKit.
This commit is contained in:
2025-11-03 17:52:12 +01:00
parent 71e1a744c5
commit 7d90142f0f

View File

@@ -176,9 +176,11 @@ func handleWS(w http.ResponseWriter, r *http.Request) {
} }
// AppleWebKit can be broken with compression. // AppleWebKit can be broken with compression.
if agent := r.UserAgent(); strings.Contains(agent, " Version/") && // It would be more reliable to check for 'ApplePaySession' in window in JS,
(strings.HasPrefix(agent, "Mozilla/5.0 (Macintosh; ") || // and have us disable compression based on a query parameter.
strings.HasPrefix(agent, "Mozilla/5.0 (iPhone; ")) { if agent := r.UserAgent(); (strings.Contains(agent, " Version/") &&
strings.HasPrefix(agent, "Mozilla/5.0 (Macintosh; ")) ||
strings.HasPrefix(agent, "Mozilla/5.0 (iPhone; ") {
opts.CompressionMode = websocket.CompressionDisabled opts.CompressionMode = websocket.CompressionDisabled
} }