aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2025-11-03 17:52:12 +0100
committerPřemysl Eric Janouch <p@janouch.name>2025-11-03 17:58:08 +0100
commit7d90142f0ff4ed1e1a16dafdd2058d86c060374e (patch)
treedd6397c16b8a615437d336f361385859fdbef61e
parent71e1a744c5521e54da333c78802cf5c57f4598db (diff)
downloadxK-7d90142f0ff4ed1e1a16dafdd2058d86c060374e.tar.gz
xK-7d90142f0ff4ed1e1a16dafdd2058d86c060374e.tar.xz
xK-7d90142f0ff4ed1e1a16dafdd2058d86c060374e.zip
xP: fix alternative browsers on iOS
As a rule, they use the same stupid and broken WebKit.
-rw-r--r--xP/xP.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/xP/xP.go b/xP/xP.go
index 7e0c386..9173afc 100644
--- a/xP/xP.go
+++ b/xP/xP.go
@@ -176,9 +176,11 @@ func handleWS(w http.ResponseWriter, r *http.Request) {
}
// AppleWebKit can be broken with compression.
- if agent := r.UserAgent(); strings.Contains(agent, " Version/") &&
- (strings.HasPrefix(agent, "Mozilla/5.0 (Macintosh; ") ||
- strings.HasPrefix(agent, "Mozilla/5.0 (iPhone; ")) {
+ // It would be more reliable to check for 'ApplePaySession' in window in JS,
+ // and have us disable compression based on a query parameter.
+ 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
}