Fallback to default UA string for all network requests
(cherry picked from commit 963cf4c99692726a05d1c8e1e2f8abdac9864056)
This commit is contained in:
parent
ea2cabfb3c
commit
322a74600e
@ -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
|
||||
|
||||
|
@ -29,6 +29,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
.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 @@ import uy.kohesive.injekt.injectLazy
|
||||
|
||||
/* SY --> */ open /* SY <-- */val cloudflareClient by lazy {
|
||||
client.newBuilder()
|
||||
.addInterceptor(UserAgentInterceptor())
|
||||
.addInterceptor(CloudflareInterceptor(context))
|
||||
.build()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user