Bläddra i källkod

Fallback to default UA string for all network requests

arkon 4 år sedan
förälder
incheckning
963cf4c996

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt

@@ -87,7 +87,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
             webView = webview
             webview.settings.javaScriptEnabled = true
 
-            // Avoid set empty User-Agent, Chromium WebView will reset to default if empty
+            // Avoid sending empty User-Agent, Chromium WebView will reset to default if empty
             webview.settings.userAgentString = request.header("User-Agent")
                 ?: HttpSource.DEFAULT_USERAGENT
 

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt

@@ -29,6 +29,7 @@ class NetworkHelper(context: Context) {
             .cache(Cache(cacheDir, cacheSize))
             .connectTimeout(30, TimeUnit.SECONDS)
             .readTimeout(30, TimeUnit.SECONDS)
+            .addInterceptor(UserAgentInterceptor())
 
         if (BuildConfig.DEBUG) {
             val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
@@ -63,7 +64,6 @@ class NetworkHelper(context: Context) {
 
     val cloudflareClient by lazy {
         client.newBuilder()
-            .addInterceptor(UserAgentInterceptor())
             .addInterceptor(CloudflareInterceptor(context))
             .build()
     }