Fix URL updater in some sources (#16867)

This commit is contained in:
stevenyomi 2023-06-26 02:34:05 +08:00 committed by GitHub
parent 5fa2a9ef1c
commit 2d3b223259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 8 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Jinman Tiantang'
pkgNameSuffix = 'zh.jinmantiantang'
extClass = '.Jinmantiantang'
extVersionCode = 36
extVersionCode = 37
isNsfw = true
}

View File

@ -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()

View File

@ -5,7 +5,7 @@ ext {
extName = 'WNACG'
pkgNameSuffix = 'zh.wnacg'
extClass = '.wnacg'
extVersionCode = 13
extVersionCode = 14
isNsfw = true
}

View File

@ -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()

View File

@ -5,7 +5,7 @@ ext {
extName = 'Zerobyw'
pkgNameSuffix = 'zh.zerobyw'
extClass = '.Zerobyw'
extVersionCode = 16
extVersionCode = 17
}
apply from: "$rootDir/common.gradle"

View File

@ -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