Webtoons.com: retry once on SSL error (#13583)

This commit is contained in:
scb261 2022-09-27 00:44:13 +03:00 committed by GitHub
parent 850c93aae1
commit d84eed451e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -46,6 +46,7 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.net.SocketException
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
@ -82,9 +83,19 @@ open class Webtoons(
} }
} }
) )
.addInterceptor(::sslRetryInterceptor)
.addInterceptor(TextInterceptor) .addInterceptor(TextInterceptor)
.build() .build()
// m.webtoons.com throws an SSL error that can be solved by a simple retry
private fun sslRetryInterceptor(chain: Interceptor.Chain): Response {
return try {
chain.proceed(chain.request())
} catch (e: SocketException) {
chain.proceed(chain.request())
}
}
private val day: String private val day: String
get() { get() {
return when (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { return when (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {

View File

@ -13,7 +13,7 @@ class WebtoonsGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 2 override val baseVersionCode: Int = 2
override val sources = listOf( override val sources = listOf(
MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh-Hant", "de"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 34), MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh-Hant", "de"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 35),
SingleLang("Dongman Manhua", "https://www.dongmanmanhua.cn", "zh") SingleLang("Dongman Manhua", "https://www.dongmanmanhua.cn", "zh")
) )

View File

@ -11,7 +11,7 @@ class WebtoonsTranslateGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 2 override val baseVersionCode: Int = 2
override val sources = listOf( override val sources = listOf(
MultiLang("Webtoons.com Translations", "https://translate.webtoons.com", listOf("en", "zh-Hans", "zh-Hant", "th", "id", "fr", "vi", "ru", "ar", "fil", "de", "hi", "it", "ja", "pt-BR", "tr", "ms", "pl", "pt", "bg", "da", "nl", "ro", "mn", "el", "lt", "cs", "sv", "bn", "fa", "uk", "es"), className = "WebtoonsTranslateFactory", pkgName = "webtoonstranslate", overrideVersionCode = 3), MultiLang("Webtoons.com Translations", "https://translate.webtoons.com", listOf("en", "zh-Hans", "zh-Hant", "th", "id", "fr", "vi", "ru", "ar", "fil", "de", "hi", "it", "ja", "pt-BR", "tr", "ms", "pl", "pt", "bg", "da", "nl", "ro", "mn", "el", "lt", "cs", "sv", "bn", "fa", "uk", "es"), className = "WebtoonsTranslateFactory", pkgName = "webtoonstranslate", overrideVersionCode = 4),
) )
companion object { companion object {