parent
0cbbe84fbb
commit
04a60a51eb
|
@ -3,7 +3,7 @@ ext {
|
|||
extClass = '.Manhastro'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://manhastro.com'
|
||||
overrideVersionCode = 4
|
||||
overrideVersionCode = 5
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ import eu.kanade.tachiyomi.multisrc.madara.Madara
|
|||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||
import org.jsoup.nodes.Document
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
@ -20,6 +22,21 @@ class Manhastro : Madara(
|
|||
|
||||
override val client: OkHttpClient = super.client.newBuilder()
|
||||
.rateLimit(1, 2, TimeUnit.SECONDS)
|
||||
.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()
|
||||
|
||||
override val useNewChapterEndpoint = true
|
||||
|
@ -39,4 +56,8 @@ class Manhastro : Madara(
|
|||
}
|
||||
|
||||
private val imageLinksPattern = """var\s+?imageLinks\s*?=\s*?(\[.*]);""".toRegex()
|
||||
|
||||
companion object {
|
||||
private const val IMG_CONTENT_TYPE = "image/jpeg"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue