CatharsisWorld: Add SSL ignore (#5394)

Add SSL ignore
This commit is contained in:
Chopper 2024-10-07 08:14:28 -03:00 committed by GitHub
parent a7ff944fed
commit ea3e69f726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.CatharsisWorld'
themePkg = 'mangathemesia'
baseUrl = 'https://catharsisworld.com'
overrideVersionCode = 0
overrideVersionCode = 1
isNsfw = true
}

View File

@ -1,7 +1,14 @@
package eu.kanade.tachiyomi.extension.es.catharsisworld
import android.annotation.SuppressLint
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.OkHttpClient
import java.security.SecureRandom
import java.security.cert.X509Certificate
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
class CatharsisWorld : MangaThemesia(
"Catharsis World",
@ -10,5 +17,24 @@ class CatharsisWorld : MangaThemesia(
) {
override val client = super.client.newBuilder()
.rateLimit(3)
.ignoreAllSSLErrors()
.build()
private fun OkHttpClient.Builder.ignoreAllSSLErrors(): OkHttpClient.Builder {
val naiveTrustManager = @SuppressLint("CustomX509TrustManager")
object : X509TrustManager {
override fun getAcceptedIssuers(): Array<X509Certificate> = emptyArray()
override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) = Unit
override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) = Unit
}
val insecureSocketFactory = SSLContext.getInstance("TLSv1.2").apply {
val trustAllCerts = arrayOf<TrustManager>(naiveTrustManager)
init(null, trustAllCerts, SecureRandom())
}.socketFactory
sslSocketFactory(insecureSocketFactory, naiveTrustManager)
hostnameVerifier { _, _ -> true }
return this
}
}