CatharsisWorld: Add SSL ignore (#5394)

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

View File

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

View File

@ -1,7 +1,14 @@
package eu.kanade.tachiyomi.extension.es.catharsisworld package eu.kanade.tachiyomi.extension.es.catharsisworld
import android.annotation.SuppressLint
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit 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( class CatharsisWorld : MangaThemesia(
"Catharsis World", "Catharsis World",
@ -10,5 +17,24 @@ class CatharsisWorld : MangaThemesia(
) { ) {
override val client = super.client.newBuilder() override val client = super.client.newBuilder()
.rateLimit(3) .rateLimit(3)
.ignoreAllSSLErrors()
.build() .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
}
} }