Horis 2 лет назад
Родитель
Сommit
3f821069ce

+ 1 - 2
app/src/main/assets/web/help/md/jsHelp.md

@@ -20,8 +20,7 @@
 |变量名|调用类|
 |------|-----|
 |java|当前类|
-|baseUrl|String,当前 url,如 `https://example.com/page/1`|
-|baseUrlWithOptions|String,带参数的当前 url,如 `https://example.com/page/1,{"webView": true}`|
+|baseUrl|当前url,String  |
 |result|上一步的结果|
 |book|[书籍类](https://github.com/gedoor/legado/blob/master/app/src/main/java/io/legado/app/data/entities/Book.kt)|
 |chapter|[章节类](https://github.com/gedoor/legado/blob/master/app/src/main/java/io/legado/app/data/entities/BookChapter.kt)|

+ 8 - 4
app/src/main/java/io/legado/app/help/JsExtensions.kt

@@ -226,11 +226,15 @@ interface JsExtensions : JsEncodeUtils {
     /**
      * 使用内置浏览器打开链接,并等待网页结果
      */
-    fun startBrowserAwait(url: String, title: String, refetchAfterSuccess: Boolean = true): StrResponse {
-        return StrResponse(
-            url,
-            SourceVerificationHelp.getVerificationResult(getSource(), url, title, true, refetchAfterSuccess)
+    fun startBrowserAwait(url: String, title: String, refetchAfterSuccess: Boolean): StrResponse {
+        val body = SourceVerificationHelp.getVerificationResult(
+            getSource(), url, title, true, refetchAfterSuccess
         )
+        return StrResponse(url, body)
+    }
+
+    fun startBrowserAwait(url: String, title: String): StrResponse {
+        return startBrowserAwait(url, title, true)
     }
 
     /**

+ 0 - 8
app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@@ -54,8 +54,6 @@ class AnalyzeRule(
         private set
     var baseUrl: String? = null
         private set
-    var optionStr: String = "{}"
-        private set
     var redirectUrl: URL? = null
         private set
     private var isJSON: Boolean = false
@@ -96,11 +94,6 @@ class AnalyzeRule(
         return this
     }
 
-    fun setOption(option: String): AnalyzeRule {
-        optionStr = option
-        return this
-    }
-
     fun setRedirectUrl(url: String): URL? {
         try {
             redirectUrl = URL(url)
@@ -754,7 +747,6 @@ class AnalyzeRule(
             bindings["book"] = book
             bindings["result"] = result
             bindings["baseUrl"] = baseUrl
-            bindings["baseUrlWithOptions"] = "$baseUrl,$optionStr"
             bindings["chapter"] = chapter
             bindings["title"] = chapter?.title
             bindings["src"] = content

+ 1 - 4
app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@@ -76,7 +76,6 @@ class AnalyzeUrl(
     var type: String? = null
         private set
     val headerMap = HashMap<String, String>()
-    var optionStr: String = ""
     private var urlNoQuery: String = ""
     private var queryStr: String? = null
     private val fieldMap = LinkedHashMap<String, String>()
@@ -194,10 +193,8 @@ class AnalyzeUrl(
             baseUrl = it
         }
         if (urlNoOption.length != ruleUrl.length) {
-            val optionStr = ruleUrl.substring(urlMatcher.end())
-            GSON.fromJsonObject<UrlOption>(optionStr).getOrNull()
+            GSON.fromJsonObject<UrlOption>(ruleUrl.substring(urlMatcher.end())).getOrNull()
                 ?.let { option ->
-                    this.optionStr = optionStr
                     option.getMethod()?.let {
                         if (it.equals("POST", true)) method = RequestMethod.POST
                     }

+ 1 - 1
app/src/main/java/io/legado/app/model/webBook/BookList.kt

@@ -43,7 +43,7 @@ object BookList {
         Debug.log(bookSource.bookSourceUrl, "≡获取成功:${analyzeUrl.ruleUrl}")
         Debug.log(bookSource.bookSourceUrl, body, state = 10)
         val analyzeRule = AnalyzeRule(ruleData, bookSource)
-        analyzeRule.setContent(body).setBaseUrl(baseUrl).setOption(analyzeUrl.optionStr)
+        analyzeRule.setContent(body).setBaseUrl(baseUrl)
         analyzeRule.setRedirectUrl(baseUrl)
         analyzeRule.setCoroutineContext(coroutineContext)
         if (isSearch) bookSource.bookUrlPattern?.let {