pull/49/head
kunfei 5 years ago
parent faa279f26e
commit cd1ff46929
  1. 7
      app/src/main/java/io/legado/app/help/http/AjaxWebView.kt
  2. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -92,7 +92,8 @@ class AjaxWebView {
mHandler.obtainMessage(DESTROY_WEB_VIEW) mHandler.obtainMessage(DESTROY_WEB_VIEW)
} }
class AjaxParams(val url: String, private val tag: String?) { class AjaxParams(val url: String) {
var tag: String? = null
var requestMethod = RequestMethod.GET var requestMethod = RequestMethod.GET
var postData: ByteArray? = null var postData: ByteArray? = null
var headerMap: Map<String, String>? = null var headerMap: Map<String, String>? = null
@ -115,9 +116,9 @@ class AjaxWebView {
get() = !TextUtils.isEmpty(sourceRegex) get() = !TextUtils.isEmpty(sourceRegex)
fun setCookie(url: String) { fun setCookie(url: String) {
if (tag != null) { tag?.let {
val cookie = CookieManager.getInstance().getCookie(url) val cookie = CookieManager.getInstance().getCookie(url)
CookieStore.setCookie(tag, cookie) CookieStore.setCookie(it, cookie)
} }
} }

@ -272,7 +272,7 @@ class AnalyzeUrl(
sourceRegex: String? = null sourceRegex: String? = null
): Res { ): Res {
if (useWebView) { if (useWebView) {
val params = AjaxWebView.AjaxParams(url, tag) val params = AjaxWebView.AjaxParams(url)
params.headerMap = headerMap params.headerMap = headerMap
params.requestMethod = method params.requestMethod = method
params.javaScript = jsStr params.javaScript = jsStr

Loading…
Cancel
Save