Skip to content

Commit b07ff30

Browse files
committed
fix brotli (mihonapp/mihon#d6c4af8)
1 parent aa2c5fe commit b07ff30

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ https://discord.gg/mihon
2020
- [ ] delegate 8muses
2121
- [ ] delegate hitomi
2222
### fix
23-
- [ ] https://github.com/mihonapp/mihon/commit/d6c4af89c4a2df213f06ed4c3d714a2608117afb
24-
~~- [ ] switch from glide to coil, and use tachiyomi's image decoder~~
23+
- [x] https://github.com/mihonapp/mihon/commit/d6c4af89c4a2df213f06ed4c3d714a2608117afb
24+
- [x] ~~switch from glide to coil, and use tachiyomi's image decoder~~
2525
- [x] include tachiyomi's image decoder for exts to use, support AVIF and HEIC
2626
- [ ] recognize CBZ downloads in UI, not only in badges
2727
- [ ] fix smart background (steal from j2k)
@@ -30,9 +30,9 @@ https://discord.gg/mihon
3030
- [x] rgb filter corrupted preview image ~~(remove?)~~ replace with fox girl drawing
3131
### match stable/j2k
3232
- [ ] allow downloading in CBZ
33-
- [ ] extlib 1.5 (migrate rx to coroutines)
33+
- [x] ~~extlib 1.5 (migrate rx to coroutines)~~ 1.5 isn't happening, but I *did* migrate pagers to coroutine, fixing the pixiv ext
3434
- [ ] re-order per-source downloads
35-
- [ ] j2k: ability to set custom cover - arbitrary file - [j2k commit](https://github.com/Jays2Kings/tachiyomiJ2K/commit/d3ec230d4baa8584118dc30807728305715db25b)
35+
- [ ] j2k: editing manga info - [j2k commit](https://github.com/Jays2Kings/tachiyomiJ2K/commit/d3ec230d4baa8584118dc30807728305715db25b)
3636
- [ ] j2k: reader: add chapter list view
3737
### maybe
3838
- [ ] add quick shortcut to extension repos in "Extensions" tab

app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import eu.kanade.tachiyomi.BuildConfig
55
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
66
import eu.kanade.tachiyomi.network.interceptor.CloudflareInterceptor
7+
import eu.kanade.tachiyomi.network.interceptor.IgnoreGzipInterceptor
78
import eu.kanade.tachiyomi.network.interceptor.UserAgentInterceptor
89
import exh.log.maybeInjectEHLogger
910
import java.io.File
@@ -33,6 +34,7 @@ open class NetworkHelper(context: Context) {
3334
.cache(Cache(cacheDir, cacheSize))
3435
.connectTimeout(30, TimeUnit.SECONDS)
3536
.readTimeout(30, TimeUnit.SECONDS)
37+
.addNetworkInterceptor(IgnoreGzipInterceptor())
3638
.addInterceptor(BrotliInterceptor)
3739
.maybeInjectEHLogger()
3840

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package eu.kanade.tachiyomi.network.interceptor
2+
3+
import okhttp3.Interceptor
4+
import okhttp3.Response
5+
6+
/**
7+
* To use [okhttp3.brotli.BrotliInterceptor] as a network interceptor,
8+
* add [IgnoreGzipInterceptor] right before it.
9+
*
10+
* This nullifies the transparent gzip of [okhttp3.internal.http.BridgeInterceptor]
11+
* so gzip and Brotli are explicitly handled by the [okhttp3.brotli.BrotliInterceptor].
12+
*/
13+
class IgnoreGzipInterceptor : Interceptor {
14+
override fun intercept(chain: Interceptor.Chain): Response {
15+
var request = chain.request()
16+
if (request.header("Accept-Encoding") == "gzip") {
17+
request = request.newBuilder().removeHeader("Accept-Encoding").build()
18+
}
19+
return chain.proceed(request)
20+
}
21+
}

0 commit comments

Comments
 (0)