From d6b88c5ee1e697968f5b82bfa10a9e17ba270bd2 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:05:54 +0800 Subject: [PATCH] Jinman Tiantang: don't update mirrors on Cloudflare errors (#17184) --- src/zh/jinmantiantang/build.gradle | 2 +- .../tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt | 2 +- .../zh/jinmantiantang/JinmantiantangPreferences.kt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zh/jinmantiantang/build.gradle b/src/zh/jinmantiantang/build.gradle index 69c77936d..4437de56a 100644 --- a/src/zh/jinmantiantang/build.gradle +++ b/src/zh/jinmantiantang/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Jinman Tiantang' pkgNameSuffix = 'zh.jinmantiantang' extClass = '.Jinmantiantang' - extVersionCode = 37 + extVersionCode = 38 isNsfw = true } diff --git a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt index 5cfab811c..f187d0a6a 100644 --- a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt +++ b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt @@ -48,7 +48,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { preferences.getString(MAINSITE_RATELIMIT_PREF, MAINSITE_RATELIMIT_PREF_DEFAULT)!!.toInt(), preferences.getString(MAINSITE_RATELIMIT_PERIOD, MAINSITE_RATELIMIT_PERIOD_DEFAULT)!!.toLong(), ) - .addInterceptor(updateUrlInterceptor) + .apply { interceptors().add(0, updateUrlInterceptor) } .addInterceptor(ScrambledImageInterceptor).build() // 点击量排序(人气) diff --git a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/JinmantiantangPreferences.kt b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/JinmantiantangPreferences.kt index 7c17a1aab..d98122536 100644 --- a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/JinmantiantangPreferences.kt +++ b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/JinmantiantangPreferences.kt @@ -93,7 +93,7 @@ private val SITE_ENTRIES_ARRAY get() = arrayOf( "jmcomic1.me", ) -private const val DEFAULT_LIST = "jm-comic2.org,jm-comic3.org,jm-comic1.org" +private const val DEFAULT_LIST = "jm-comic3.art,jm-comic1.art,jm-comic2.ark" private const val DEFAULT_LIST_PREF = "defaultBaseUrlList" private const val URL_LIST_PREF = "baseUrlList" @@ -132,12 +132,12 @@ class UpdateUrlInterceptor(private val preferences: SharedPreferences) : Interce response.close() Result.success(response) } catch (e: Throwable) { - if (chain.call().isCanceled()) throw e + if (chain.call().isCanceled() || e.message?.contains("Cloudflare") == true) throw e Result.failure(e) } if (isUpdated || updateUrl(chain)) { - throw IOException("镜像网址已自动更新,请在插件设置中选择合适的镜像网址并重启应用") + throw IOException("镜像网址已自动更新,请在插件设置中选择合适的镜像网址并重启应用(如果反复提示,可能是服务器故障)") } return failedResponse.getOrThrow() }