diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 6a373bdef..8addf77db 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -70,8 +70,15 @@ data class BookSource( val headerMap = HashMap() headerMap["User-Agent"] = App.INSTANCE.getPrefString("user_agent") ?: userAgent header?.let { - GSON.fromJsonObject>(header)?.let { - headerMap.putAll(it) + val header1 = when { + it.startsWith("@js:", true) -> + AppConst.SCRIPT_ENGINE.eval(it.substring(4)).toString() + it.startsWith("", true) -> + AppConst.SCRIPT_ENGINE.eval(it.substring(4, it.lastIndexOf("<"))).toString() + else -> it + } + GSON.fromJsonObject>(header1)?.let { headers -> + headerMap.putAll(headers) } } return headerMap