Change user agent to Chrome

This commit is contained in:
Zakhar Timoshenko
2023-02-05 18:30:28 +03:00
committed by Koitharu
parent 7ffa15d2d7
commit 9b290bea40
3 changed files with 5 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ class BrowserActivity : BaseActivity<ActivityBrowserBinding>(), BrowserCallback
}
with(binding.webView.settings) {
javaScriptEnabled = true
userAgentString = UserAgentInterceptor.userAgent
userAgentString = UserAgentInterceptor.userAgentChrome
}
binding.webView.webViewClient = BrowserClient(this)
binding.webView.webChromeClient = ProgressChromeClient(binding.progressBar)

View File

@@ -42,7 +42,7 @@ class CloudFlareDialog : AlertDialogFragment<FragmentCloudflareBinding>(), Cloud
cacheMode = WebSettings.LOAD_DEFAULT
domStorageEnabled = true
databaseEnabled = true
userAgentString = UserAgentInterceptor.userAgent
userAgentString = UserAgentInterceptor.userAgentChrome
}
binding.webView.webViewClient = CloudFlareClient(cookieJar, this, url.orEmpty())
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.webView, true)

View File

@@ -13,7 +13,7 @@ class UserAgentInterceptor : Interceptor {
return chain.proceed(
if (request.header(CommonHeaders.USER_AGENT) == null) {
request.newBuilder()
.addHeader(CommonHeaders.USER_AGENT, userAgent)
.addHeader(CommonHeaders.USER_AGENT, userAgentChrome)
.build()
} else request
)
@@ -29,7 +29,7 @@ class UserAgentInterceptor : Interceptor {
Build.BRAND,
Build.DEVICE,
Locale.getDefault().language
)
) // TODO Decide what to do with this afterwards
val userAgentChrome
get() = (
@@ -40,4 +40,4 @@ class UserAgentInterceptor : Interceptor {
Build.MODEL,
)
}
}
}