Mangaforfreecom: trust all certificate (#822)
* Mangaforfreecom: trust all certificate * clean * small fix * comply * comply --------- Co-authored-by: ghost <ghost@gmail.com>
This commit is contained in:
parent
4b5a4eee30
commit
5f8099de05
|
@ -0,0 +1,44 @@
|
|||
package eu.kanade.tachiyomi.extension.all.mangaforfreecom
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import okhttp3.OkHttpClient
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.TrustManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
|
||||
class Mangaforfreecom : Madara("Mangaforfree.com", "https://mangaforfree.com", "en") {
|
||||
override val client = getUnsafeOkHttpClient()
|
||||
|
||||
private fun getUnsafeOkHttpClient(): OkHttpClient {
|
||||
val trustAllCerts =
|
||||
arrayOf<TrustManager>(
|
||||
@SuppressLint("CustomX509TrustManager")
|
||||
object : X509TrustManager {
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
override fun checkClientTrusted(
|
||||
chain: Array<out X509Certificate>?,
|
||||
authType: String?,
|
||||
) {
|
||||
}
|
||||
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
override fun checkServerTrusted(
|
||||
chain: Array<out X509Certificate>?,
|
||||
authType: String?,
|
||||
) {
|
||||
}
|
||||
|
||||
override fun getAcceptedIssuers() = arrayOf<X509Certificate>()
|
||||
},
|
||||
)
|
||||
|
||||
val sslContext = SSLContext.getInstance("SSL")
|
||||
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
||||
val sslSocketFactory = sslContext.socketFactory
|
||||
return super.client.newBuilder()
|
||||
.sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager)
|
||||
.hostnameVerifier { _, _ -> true }.build()
|
||||
}
|
||||
}
|
|
@ -257,7 +257,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
SingleLang("MangaDods", "https://mangadods.com", "en", overrideVersionCode = 3),
|
||||
SingleLang("MangaDol", "https://mangadol.com", "en"),
|
||||
SingleLang("MangaEffect", "https://mangaeffect.com", "en", overrideVersionCode = 1),
|
||||
SingleLang("Mangaforfree.com", "https://mangaforfree.com", "en", isNsfw = true, className = "Mangaforfreecom"),
|
||||
SingleLang("Mangaforfree.com", "https://mangaforfree.com", "en", isNsfw = true, className = "Mangaforfreecom", overrideVersionCode = 1),
|
||||
SingleLang("MangaFoxFull", "https://mangafoxfull.com", "en"),
|
||||
SingleLang("MangaFreak.online", "https://mangafreak.online", "en", className = "MangaFreakOnline"),
|
||||
SingleLang("MangaGG", "https://mangagg.com", "en", overrideVersionCode = 2),
|
||||
|
|
Loading…
Reference in New Issue