pull/1999/head
kunfei 2 years ago
parent d416e84b2b
commit 8a241ccc34
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  2. 1
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  3. 2
      app/src/main/java/io/legado/app/utils/MapExtensions.kt

@ -554,7 +554,7 @@ class AnalyzeUrl(
} }
fun getUserAgent(): String { fun getUserAgent(): String {
return headerMap[UA_NAME] ?: AppConfig.userAgent return headerMap.get(UA_NAME, true) ?: AppConfig.userAgent
} }
fun isPost(): Boolean { fun isPost(): Boolean {

@ -188,6 +188,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
} }
viewModel.urlLiveData.observe(this) { viewModel.urlLiveData.observe(this) {
upJavaScriptEnable() upJavaScriptEnable()
binding.webView.settings.userAgentString = it.getUserAgent()
binding.webView.loadUrl(it.url, it.headerMap) binding.webView.loadUrl(it.url, it.headerMap)
} }
} }

@ -9,7 +9,7 @@ fun HashMap<String, *>.has(key: String, ignoreCase: Boolean = false): Boolean {
return false return false
} }
fun HashMap<String, *>.get(key: String, ignoreCase: Boolean = false): Any? { fun <T> HashMap<String, T>.get(key: String, ignoreCase: Boolean = false): T? {
for (item in this) { for (item in this) {
if (key.equals(item.key, ignoreCase)) { if (key.equals(item.key, ignoreCase)) {
return item.value return item.value

Loading…
Cancel
Save