VIZ: Fix images could not be loaded (#19201)

Remove Accept-Encoding header
This commit is contained in:
bapeey 2023-12-07 08:37:39 -05:00 committed by GitHub
parent d14c9ba1ad
commit 1f0cf4f713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'VIZ'
pkgNameSuffix = 'en.vizshonenjump'
extClass = '.VizFactory'
extVersionCode = 19
extVersionCode = 20
}
dependencies {

View File

@ -40,6 +40,7 @@ open class Viz(
override val supportsLatest = true
override val client: OkHttpClient = network.client.newBuilder()
.addInterceptor(::headersIntercept)
.addInterceptor(::authCheckIntercept)
.addInterceptor(::authChapterCheckIntercept)
.addInterceptor(VizImageInterceptor())
@ -293,6 +294,14 @@ open class Viz(
loginCheckResponse.close()
}
private fun headersIntercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val headers = request.headers.newBuilder()
.removeAll("Accept-Encoding")
.build()
return chain.proceed(request.newBuilder().headers(headers).build())
}
private fun authCheckIntercept(chain: Interceptor.Chain): Response {
if (loggedIn == null) {
checkIfIsLoggedIn(chain)