Fix ratings fetch: remove brotli Accept-Encoding header

OkHttp doesn't support brotli decompression, so when servers return
brotli-compressed content, it was being read as raw binary garbage.
Removed explicit Accept-Encoding to let OkHttp handle compression
(it automatically adds gzip/deflate which it can decompress).

Also removed unnecessary Sec-Fetch-* headers.
This commit is contained in:
Claude Brisson
2025-11-29 11:08:48 +01:00
parent 09c8e834f6
commit 935f53cf65

View File

@@ -107,15 +107,11 @@ abstract class RatingsHandler(val origin: RatingsManager.Ratings) {
val request = Request.Builder()
.url(url)
.header("User-Agent", USER_AGENT)
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "en-US,en;q=0.9")
.header("Accept-Encoding", "gzip, deflate, br")
// Let OkHttp handle compression (it supports gzip/deflate but not brotli)
.header("Connection", "keep-alive")
.header("Upgrade-Insecure-Requests", "1")
.header("Sec-Fetch-Dest", "document")
.header("Sec-Fetch-Mode", "navigate")
.header("Sec-Fetch-Site", "none")
.header("Sec-Fetch-User", "?1")
.build()
client.newCall(request).execute().use { response ->