mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -97,7 +97,7 @@ interface BaseSource : JsExtensions {
|
||||
* 解析header规则
|
||||
*/
|
||||
fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
|
||||
if (checkRhinoRecursiveCall()) return@apply
|
||||
checkRhinoRecursiveCall()
|
||||
header?.let {
|
||||
GSON.fromJsonObject<Map<String, String>>(
|
||||
when {
|
||||
|
||||
@@ -13,10 +13,14 @@ fun Context?.getEnterCount(): Int {
|
||||
return enterCountField.get(this) as Int
|
||||
}
|
||||
|
||||
fun checkRhinoRecursiveCall(): Boolean {
|
||||
return Context.getCurrentContext().getEnterCount() > 1
|
||||
fun checkRhinoRecursiveCall() {
|
||||
check(Context.getCurrentContext().getEnterCount() <= 1) {
|
||||
"Rhino recursive call detected."
|
||||
}
|
||||
}
|
||||
|
||||
fun checkRhinoCall(): Boolean {
|
||||
return Context.getCurrentContext() != null
|
||||
fun checkRhinoCall() {
|
||||
check(Context.getCurrentContext() == null) {
|
||||
"Rhino call detected."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user