From 2d3b22325911678ed6b3c9794bf994b1f5c965b8 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Mon, 26 Jun 2023 02:34:05 +0800 Subject: [PATCH] Fix URL updater in some sources (#16867) --- src/zh/jinmantiantang/build.gradle | 2 +- .../extension/zh/jinmantiantang/JinmantiantangPreferences.kt | 4 ++-- src/zh/wnacg/build.gradle | 2 +- .../src/eu/kanade/tachiyomi/extension/zh/wnacg/Preferences.kt | 4 ++-- src/zh/zerobyw/build.gradle | 2 +- .../src/eu/kanade/tachiyomi/extension/zh/zerobyw/UpdateUrl.kt | 3 ++- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/zh/jinmantiantang/build.gradle b/src/zh/jinmantiantang/build.gradle index a3af00d86..69c77936d 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 = 36 + extVersionCode = 37 isNsfw = true } 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 1f5e6688f..7c17a1aab 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.cc,jm-comic.org,jmcomic2.group" +private const val DEFAULT_LIST = "jm-comic2.org,jm-comic3.org,jm-comic1.org" private const val DEFAULT_LIST_PREF = "defaultBaseUrlList" private const val URL_LIST_PREF = "baseUrlList" @@ -129,6 +129,7 @@ class UpdateUrlInterceptor(private val preferences: SharedPreferences) : Interce val failedResponse = try { val response = chain.proceed(request) if (response.isSuccessful) return response + response.close() Result.success(response) } catch (e: Throwable) { if (chain.call().isCanceled()) throw e @@ -136,7 +137,6 @@ class UpdateUrlInterceptor(private val preferences: SharedPreferences) : Interce } if (isUpdated || updateUrl(chain)) { - failedResponse.onSuccess(Response::close) throw IOException("镜像网址已自动更新,请在插件设置中选择合适的镜像网址并重启应用") } return failedResponse.getOrThrow() diff --git a/src/zh/wnacg/build.gradle b/src/zh/wnacg/build.gradle index 0e50b8a2e..fcb3d2a92 100644 --- a/src/zh/wnacg/build.gradle +++ b/src/zh/wnacg/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'WNACG' pkgNameSuffix = 'zh.wnacg' extClass = '.wnacg' - extVersionCode = 13 + extVersionCode = 14 isNsfw = true } diff --git a/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/Preferences.kt b/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/Preferences.kt index 70525cac5..ca3ef52b3 100644 --- a/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/Preferences.kt +++ b/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/Preferences.kt @@ -12,7 +12,7 @@ import uy.kohesive.injekt.api.get import java.io.IOException import kotlin.random.Random -private const val DEFAULT_LIST = "https://www.htmanga3.top,https://www.htmanga4.top,https://www.htmanga5.top" +private const val DEFAULT_LIST = "https://www.htmanga9.top,https://www.htmanga7.top,https://www.htmanga6.top,https://www.htmanga3.top,https://www.htmanga4.top,https://www.htmanga5.top" fun getPreferencesInternal( context: Context, @@ -72,6 +72,7 @@ class UpdateUrlInterceptor(private val preferences: SharedPreferences) : Interce val failedResponse = try { val response = chain.proceed(request) if (response.isSuccessful) return response + response.close() Result.success(response) } catch (e: Throwable) { if (chain.call().isCanceled()) throw e @@ -79,7 +80,6 @@ class UpdateUrlInterceptor(private val preferences: SharedPreferences) : Interce } if (isUpdated || updateUrl(chain)) { - failedResponse.onSuccess(Response::close) throw IOException("网址已自动更新,请重启应用") } return failedResponse.getOrThrow() diff --git a/src/zh/zerobyw/build.gradle b/src/zh/zerobyw/build.gradle index 55f7506fa..8f7535ab0 100644 --- a/src/zh/zerobyw/build.gradle +++ b/src/zh/zerobyw/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Zerobyw' pkgNameSuffix = 'zh.zerobyw' extClass = '.Zerobyw' - extVersionCode = 16 + extVersionCode = 17 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/UpdateUrl.kt b/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/UpdateUrl.kt index a64a5c00c..d4cde2bfa 100644 --- a/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/UpdateUrl.kt +++ b/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/UpdateUrl.kt @@ -11,7 +11,7 @@ import okhttp3.OkHttpClient import okhttp3.Response import java.io.IOException -private const val DEFAULT_BASE_URL = "http://www.zerobyw3.com" +private const val DEFAULT_BASE_URL = "http://www.zerobyw007.com" private const val BASE_URL_PREF = "ZEROBYW_BASEURL" private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl" @@ -79,6 +79,7 @@ class UpdateUrlInterceptor( val failedResult = try { val response = chain.proceed(request) if (response.isSuccessful) return response + response.close() Result.success(response) } catch (e: IOException) { if (chain.call().isCanceled()) throw e