komiktap: correct image mime type (#4454)
This commit is contained in:
parent
0ea2b99616
commit
271855037e
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.Komiktap'
|
extClass = '.Komiktap'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://komiktap.info'
|
baseUrl = 'https://komiktap.info'
|
||||||
overrideVersionCode = 2
|
overrideVersionCode = 3
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,31 @@ import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.Cookie
|
import okhttp3.Cookie
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class Komiktap : MangaThemesia("Komiktap", "https://komiktap.info", "id") {
|
class Komiktap : MangaThemesia("Komiktap", "https://komiktap.info", "id") {
|
||||||
override val client = super.client.newBuilder().addInterceptor(::sucuriInterceptor).build()
|
|
||||||
|
override val client = super.client.newBuilder()
|
||||||
|
.addInterceptor(::sucuriInterceptor)
|
||||||
|
.addInterceptor { chain ->
|
||||||
|
val response = chain.proceed(chain.request())
|
||||||
|
val mime = response.headers["Content-Type"]
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
if (mime != "application/octet-stream") {
|
||||||
|
return@addInterceptor response
|
||||||
|
}
|
||||||
|
// Fix image content type
|
||||||
|
val type = IMG_CONTENT_TYPE.toMediaType()
|
||||||
|
val body = response.body.bytes().toResponseBody(type)
|
||||||
|
return@addInterceptor response.newBuilder().body(body)
|
||||||
|
.header("Content-Type", IMG_CONTENT_TYPE).build()
|
||||||
|
}
|
||||||
|
response
|
||||||
|
}
|
||||||
|
.build()
|
||||||
|
|
||||||
// Taken from es/ManhwasNet
|
// Taken from es/ManhwasNet
|
||||||
private fun sucuriInterceptor(chain: Interceptor.Chain): Response {
|
private fun sucuriInterceptor(chain: Interceptor.Chain): Response {
|
||||||
|
@ -45,3 +65,5 @@ class Komiktap : MangaThemesia("Komiktap", "https://komiktap.info", "id") {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val IMG_CONTENT_TYPE = "image/jpeg"
|
||||||
|
|
Loading…
Reference in New Issue