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()) {
val bindings = SimpleBindings()
bindings["baseUrl"] = bookSourceUrl
bindings["java"] = JsExtensions()
bindings["java"] = JsExtensions
a = AppConst.SCRIPT_ENGINE.eval(
it.substring(4, it.lastIndexOf("<")),
bindings

@ -8,7 +8,7 @@ import java.util.regex.Pattern
@Suppress("unused")
class JsExtensions {
object JsExtensions {
/**
* 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.IHttpPostApi
import io.legado.app.data.entities.BaseBook
import io.legado.app.help.JsExtensions
import io.legado.app.help.http.HttpHelper
import io.legado.app.utils.*
import kotlinx.coroutines.Deferred
@ -139,6 +140,7 @@ class AnalyzeUrl(
var jsEval: Any
val sb = StringBuffer(ruleUrl.length)
val simpleBindings = SimpleBindings()
simpleBindings["java"] = JsExtensions
simpleBindings["baseUrl"] = baseUrl
simpleBindings["page"] = page
simpleBindings["key"] = key
@ -238,7 +240,7 @@ class AnalyzeUrl(
book: BaseBook?
): Any {
val bindings = SimpleBindings()
bindings["java"] = this
bindings["java"] = JsExtensions
bindings["page"] = page
bindings["key"] = key
bindings["book"] = book

Loading…
Cancel
Save