Skip to content

Commit

Permalink
fix brotli (mihonapp/mihon#d6c4af8)
Browse files Browse the repository at this point in the history
  • Loading branch information
az4521 committed Feb 17, 2024
1 parent aa2c5fe commit b07ff30
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ https://discord.gg/mihon
- [ ] delegate 8muses
- [ ] delegate hitomi
### fix
- [ ] https://github.com/mihonapp/mihon/commit/d6c4af89c4a2df213f06ed4c3d714a2608117afb
~~- [ ] switch from glide to coil, and use tachiyomi's image decoder~~
- [x] https://github.com/mihonapp/mihon/commit/d6c4af89c4a2df213f06ed4c3d714a2608117afb
- [x] ~~switch from glide to coil, and use tachiyomi's image decoder~~
- [x] include tachiyomi's image decoder for exts to use, support AVIF and HEIC
- [ ] recognize CBZ downloads in UI, not only in badges
- [ ] fix smart background (steal from j2k)
Expand All @@ -30,9 +30,9 @@ https://discord.gg/mihon
- [x] rgb filter corrupted preview image ~~(remove?)~~ replace with fox girl drawing
### match stable/j2k
- [ ] allow downloading in CBZ
- [ ] extlib 1.5 (migrate rx to coroutines)
- [x] ~~extlib 1.5 (migrate rx to coroutines)~~ 1.5 isn't happening, but I *did* migrate pagers to coroutine, fixing the pixiv ext
- [ ] re-order per-source downloads
- [ ] j2k: ability to set custom cover - arbitrary file - [j2k commit](https://github.com/Jays2Kings/tachiyomiJ2K/commit/d3ec230d4baa8584118dc30807728305715db25b)
- [ ] j2k: editing manga info - [j2k commit](https://github.com/Jays2Kings/tachiyomiJ2K/commit/d3ec230d4baa8584118dc30807728305715db25b)
- [ ] j2k: reader: add chapter list view
### maybe
- [ ] add quick shortcut to extension repos in "Extensions" tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.network.interceptor.CloudflareInterceptor
import eu.kanade.tachiyomi.network.interceptor.IgnoreGzipInterceptor
import eu.kanade.tachiyomi.network.interceptor.UserAgentInterceptor
import exh.log.maybeInjectEHLogger
import java.io.File
Expand Down Expand Up @@ -33,6 +34,7 @@ open class NetworkHelper(context: Context) {
.cache(Cache(cacheDir, cacheSize))
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.addNetworkInterceptor(IgnoreGzipInterceptor())
.addInterceptor(BrotliInterceptor)
.maybeInjectEHLogger()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package eu.kanade.tachiyomi.network.interceptor

import okhttp3.Interceptor
import okhttp3.Response

/**
* To use [okhttp3.brotli.BrotliInterceptor] as a network interceptor,
* add [IgnoreGzipInterceptor] right before it.
*
* This nullifies the transparent gzip of [okhttp3.internal.http.BridgeInterceptor]
* so gzip and Brotli are explicitly handled by the [okhttp3.brotli.BrotliInterceptor].
*/
class IgnoreGzipInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
var request = chain.request()
if (request.header("Accept-Encoding") == "gzip") {
request = request.newBuilder().removeHeader("Accept-Encoding").build()
}
return chain.proceed(request)
}
}

0 comments on commit b07ff30

Please sign in to comment.