Fallback to Okhttp instead (#1771)
* Fallback to Okhttp instead * Drop unused proguard * Exclude okhttp3 public suffix * Refine * Refine --------- Co-authored-by: Dude so hot <djohn@fbi.gov>
This commit is contained in:
1 parent
6601a45472
commit
c6b6d9a310
6 files changed
+10
-45
No files matched your search
@@ -146,7 +146,7 @@ android {
|
||||
"**.txt",
|
||||
"**.bin",
|
||||
"**.{html,mmd}", // Compose Destination
|
||||
"**.properties", // Apache 5 HC version info
|
||||
"/okhttp3/**", // Okhttp public suffix
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ dependencies {
|
||||
|
||||
implementation(libs.telephoto.zoomable)
|
||||
|
||||
implementation(libs.bundles.http.client)
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
|
||||
implementation(libs.bundles.kotlinx.serialization)
|
||||
|
||||
|
||||
Vendored
-4
@@ -14,10 +14,6 @@
|
||||
# Ktor logger
|
||||
-dontwarn org.slf4j.impl.StaticLoggerBinder
|
||||
|
||||
# Conscrypt
|
||||
-dontwarn com.android.org.conscrypt.SSLParametersImpl
|
||||
-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
|
||||
|
||||
# https://issuetracker.google.com/222232895
|
||||
-dontwarn androidx.window.extensions.**
|
||||
-dontwarn androidx.window.sidecar.Sidecar*
|
||||
|
||||
@@ -70,7 +70,7 @@ import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
import eu.kanade.tachiyomi.util.lang.withUIContext
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.engine.apache5.Apache5
|
||||
import io.ktor.client.engine.okhttp.OkHttp
|
||||
import io.ktor.client.plugins.cookies.HttpCookies
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -205,7 +205,7 @@ class EhApplication :
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HttpClient(Apache5) {
|
||||
HttpClient(OkHttp) {
|
||||
engine {
|
||||
configureClient()
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.hippo.ehviewer.ktor
|
||||
|
||||
import com.hippo.ehviewer.util.isAtLeastQ
|
||||
import io.ktor.client.engine.apache5.Apache5EngineConfig
|
||||
import java.security.Security
|
||||
import org.apache.hc.client5.http.config.ConnectionConfig
|
||||
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder
|
||||
import org.apache.hc.core5.reactor.IOReactorConfig
|
||||
import org.apache.hc.core5.util.Timeout
|
||||
import org.conscrypt.Conscrypt
|
||||
|
||||
fun Apache5EngineConfig.configureClient() {
|
||||
if (!isAtLeastQ) {
|
||||
Security.insertProviderAt(Conscrypt.newProvider(), 1)
|
||||
}
|
||||
customizeClient {
|
||||
setConnectionManager(
|
||||
PoolingAsyncClientConnectionManagerBuilder.create().apply {
|
||||
setDefaultConnectionConfig(
|
||||
ConnectionConfig.custom().apply {
|
||||
setConnectTimeout(Timeout.ofMilliseconds(connectTimeout))
|
||||
setSocketTimeout(Timeout.ofMilliseconds(socketTimeout.toLong()))
|
||||
}.build(),
|
||||
)
|
||||
setIOReactorConfig(
|
||||
IOReactorConfig.custom().apply {
|
||||
setIoThreadCount(1)
|
||||
}.build(),
|
||||
)
|
||||
}.build(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.hippo.ehviewer.ktor
|
||||
|
||||
import io.ktor.client.engine.okhttp.OkHttpConfig
|
||||
|
||||
fun OkHttpConfig.configureClient() = Unit
|
||||
@@ -81,8 +81,6 @@ compose-destinations-compiler = { module = "io.github.raamcosta.compose-destinat
|
||||
|
||||
material-motion-core = "io.github.fornewid:material-motion-compose-core:2.0.1"
|
||||
|
||||
conscrypt = "org.conscrypt:conscrypt-android:2.5.3"
|
||||
|
||||
desugar = "com.android.tools:desugar_jdk_libs_nio:2.1.2"
|
||||
|
||||
diff = "io.github.petertrr:kotlin-multiplatform-diff:0.7.0"
|
||||
@@ -93,7 +91,7 @@ kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.
|
||||
|
||||
ktlint = "com.pinterest:ktlint:1.4.0-kotlin-dev-SNAPSHOT"
|
||||
|
||||
ktor-client-apache5 = { module = "io.ktor:ktor-client-apache5", version.ref = "ktor" }
|
||||
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||
|
||||
logcat = "com.squareup.logcat:logcat:0.1"
|
||||
|
||||
@@ -122,7 +120,6 @@ androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstall
|
||||
[bundles]
|
||||
coil = ["coil-compose", "coil-gif", "coil-network"]
|
||||
compose = ["compose-foundation", "compose-material-icons-extended", "compose-material3", "compose-material3-adaptive", "compose-ui-util"]
|
||||
http-client = ["conscrypt", "ktor-client-apache5"]
|
||||
kotlinx-serialization = ["serialization-cbor", "serialization-json", "serialization-json-okio", "serialization-xml"]
|
||||
splitties = ["splitties-appctx", "splitties-arch-room", "splitties-preferences", "splitties-systemservices"]
|
||||
|
||||
|
||||
Reference in new issue
Block a user