diff --git a/src/zh/baozimanhua/CHANGELOG.md b/src/zh/baozimanhua/CHANGELOG.md index a0e74b68d..91cf14a0c 100644 --- a/src/zh/baozimanhua/CHANGELOG.md +++ b/src/zh/baozimanhua/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.17 (2022-12-29) + +- 修复部分图片无法加载的问题 +- 停止加载缺失的图片(原本加载为“漫画”二字) + ## 1.3.16 (2022-12-17) - 搜索漫画时自动使用 baozimh.com 域名以避免出错 diff --git a/src/zh/baozimanhua/build.gradle b/src/zh/baozimanhua/build.gradle index 15603353f..c42ad4f3c 100644 --- a/src/zh/baozimanhua/build.gradle +++ b/src/zh/baozimanhua/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Baozi Manhua' pkgNameSuffix = 'zh.baozimanhua' extClass = '.Baozi' - extVersionCode = 16 + extVersionCode = 17 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt index 3245c2f87..a2da20214 100644 --- a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt +++ b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt @@ -51,8 +51,12 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { override val client = network.cloudflareClient.newBuilder() .rateLimit(2) .addInterceptor(bannerInterceptor) + .addNetworkInterceptor(MissingImageInterceptor) .build() + override fun headersBuilder() = super.headersBuilder() + .add("Referer", "$baseUrl/") + override fun chapterListSelector() = throw UnsupportedOperationException("Not used.") override fun chapterListParse(response: Response): List { diff --git a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/MissingImageInterceptor.kt b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/MissingImageInterceptor.kt new file mode 100644 index 000000000..1f148f3b2 --- /dev/null +++ b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/MissingImageInterceptor.kt @@ -0,0 +1,14 @@ +package eu.kanade.tachiyomi.extension.zh.baozimanhua + +import okhttp3.Interceptor +import okhttp3.Response + +object MissingImageInterceptor : Interceptor { + override fun intercept(chain: Interceptor.Chain): Response { + val response = chain.proceed(chain.request()) + if (response.isRedirect && response.header("location") == "https://static-tw.baozimh.com/cover/404.jpg") { + return response.newBuilder().code(404).build() + } + return response + } +}