pull/38/head
kunfei 5 years ago
parent 0b7e210051
commit 52e4d43191
  1. 11
      app/src/main/java/io/legado/app/data/entities/BookSource.kt

@ -70,8 +70,15 @@ data class BookSource(
val headerMap = HashMap<String, String>() val headerMap = HashMap<String, String>()
headerMap["User-Agent"] = App.INSTANCE.getPrefString("user_agent") ?: userAgent headerMap["User-Agent"] = App.INSTANCE.getPrefString("user_agent") ?: userAgent
header?.let { header?.let {
GSON.fromJsonObject<Map<String, String>>(header)?.let { val header1 = when {
headerMap.putAll(it) it.startsWith("@js:", true) ->
AppConst.SCRIPT_ENGINE.eval(it.substring(4)).toString()
it.startsWith("<js>", true) ->
AppConst.SCRIPT_ENGINE.eval(it.substring(4, it.lastIndexOf("<"))).toString()
else -> it
}
GSON.fromJsonObject<Map<String, String>>(header1)?.let { headers ->
headerMap.putAll(headers)
} }
} }
return headerMap return headerMap

Loading…
Cancel
Save