ArgosComics: Fix downloads (#3661)

Fix
This commit is contained in:
bapeey 2024-06-21 03:42:18 -05:00 committed by Draff
parent 96335c8575
commit b6d14247af
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 17 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.ArgosComics'
themePkg = 'madara'
baseUrl = 'https://argoscomic.com'
overrideVersionCode = 3
overrideVersionCode = 4
}
apply from: "$rootDir/common.gradle"

View File

@ -2,6 +2,8 @@ package eu.kanade.tachiyomi.extension.pt.argoscomics
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.ResponseBody.Companion.toResponseBody
import java.text.SimpleDateFormat
import java.util.Locale
@ -13,6 +15,20 @@ class ArgosComics : Madara(
) {
override val client = super.client.newBuilder()
.rateLimit(3)
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
val mime = response.headers["Content-Type"]
if (response.isSuccessful) {
if (mime == "application/octet-stream" || mime == null) {
// Fix image content type
val type = "image/jpeg".toMediaType()
val body = response.body.bytes().toResponseBody(type)
return@addInterceptor response.newBuilder().body(body)
.header("Content-Type", "image/jpeg").build()
}
}
response
}
.build()
override val useLoadMoreRequest = LoadMoreStrategy.Always