pull/38/head
kunfei 5 years ago
parent 9fafda85dc
commit a8dca31be2
  1. 2
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 2
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  3. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -137,7 +137,7 @@ data class BookSource(
if (a.isBlank()) { if (a.isBlank()) {
val bindings = SimpleBindings() val bindings = SimpleBindings()
bindings["baseUrl"] = bookSourceUrl bindings["baseUrl"] = bookSourceUrl
bindings["java"] = JsExtensions() bindings["java"] = JsExtensions
a = AppConst.SCRIPT_ENGINE.eval( a = AppConst.SCRIPT_ENGINE.eval(
it.substring(4, it.lastIndexOf("<")), it.substring(4, it.lastIndexOf("<")),
bindings bindings

@ -8,7 +8,7 @@ import java.util.regex.Pattern
@Suppress("unused") @Suppress("unused")
class JsExtensions { object JsExtensions {
/** /**
* js实现跨域访问,不能删 * js实现跨域访问,不能删

@ -9,6 +9,7 @@ import io.legado.app.constant.Pattern.JS_PATTERN
import io.legado.app.data.api.IHttpGetApi import io.legado.app.data.api.IHttpGetApi
import io.legado.app.data.api.IHttpPostApi import io.legado.app.data.api.IHttpPostApi
import io.legado.app.data.entities.BaseBook import io.legado.app.data.entities.BaseBook
import io.legado.app.help.JsExtensions
import io.legado.app.help.http.HttpHelper import io.legado.app.help.http.HttpHelper
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.coroutines.Deferred import kotlinx.coroutines.Deferred
@ -139,6 +140,7 @@ class AnalyzeUrl(
var jsEval: Any var jsEval: Any
val sb = StringBuffer(ruleUrl.length) val sb = StringBuffer(ruleUrl.length)
val simpleBindings = SimpleBindings() val simpleBindings = SimpleBindings()
simpleBindings["java"] = JsExtensions
simpleBindings["baseUrl"] = baseUrl simpleBindings["baseUrl"] = baseUrl
simpleBindings["page"] = page simpleBindings["page"] = page
simpleBindings["key"] = key simpleBindings["key"] = key
@ -238,7 +240,7 @@ class AnalyzeUrl(
book: BaseBook? book: BaseBook?
): Any { ): Any {
val bindings = SimpleBindings() val bindings = SimpleBindings()
bindings["java"] = this bindings["java"] = JsExtensions
bindings["page"] = page bindings["page"] = page
bindings["key"] = key bindings["key"] = key
bindings["book"] = book bindings["book"] = book

Loading…
Cancel
Save