From 22e8050fff273a189d2fdfae6e66ec622f04f1dd Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 15 Jul 2023 09:34:20 -0400 Subject: [PATCH] Handle Cloudflare in default network client and deprecate cloudflareClient --- .../eu/kanade/tachiyomi/network/NetworkHelper.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index efbdacb9d5..54d1858839 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -44,6 +44,8 @@ class NetworkHelper( builder.addNetworkInterceptor(httpLoggingInterceptor) } + builder.addInterceptor(cloudflareInterceptor) + when (preferences.dohProvider().get()) { PREF_DOH_CLOUDFLARE -> builder.dohCloudflare() PREF_DOH_GOOGLE -> builder.dohGoogle() @@ -64,12 +66,12 @@ class NetworkHelper( val client by lazy { baseClientBuilder.cache(Cache(cacheDir, cacheSize)).build() } + /** + * @deprecated Since extension-lib 1.5 + */ + @Deprecated("The regular client handles Cloudflare by default") @Suppress("UNUSED") - val cloudflareClient by lazy { - client.newBuilder() - .addInterceptor(cloudflareInterceptor) - .build() - } + val cloudflareClient = client fun defaultUserAgentProvider() = preferences.defaultUserAgent().get().trim() }