优化
This commit is contained in:
@@ -14,7 +14,9 @@ import io.legado.app.help.crypto.SymmetricCryptoAndroid
|
||||
import io.legado.app.help.http.CookieStore
|
||||
import io.legado.app.help.source.copy
|
||||
import io.legado.app.help.source.getShareScope
|
||||
import io.legado.app.model.Debug
|
||||
import io.legado.app.utils.GSON
|
||||
import io.legado.app.utils.GSONStrict
|
||||
import io.legado.app.utils.fromJsonArray
|
||||
import io.legado.app.utils.fromJsonObject
|
||||
import io.legado.app.utils.has
|
||||
@@ -112,7 +114,10 @@ interface BaseSource : JsExtensions {
|
||||
|
||||
else -> it
|
||||
}
|
||||
GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
|
||||
GSONStrict.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
|
||||
putAll(map)
|
||||
} ?: GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
|
||||
Debug.log("≡请求头规则 JSON 格式不规范,请改为规范格式")
|
||||
putAll(map)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -520,6 +520,12 @@ class AnalyzeRule(
|
||||
return ruleList
|
||||
}
|
||||
|
||||
private fun getOrCreateSingleSourceRule(rule: String): List<SourceRule> {
|
||||
return stringRuleCache.getOrPutLimit(rule, 16) {
|
||||
listOf(SourceRule(rule))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则类
|
||||
*/
|
||||
@@ -672,7 +678,8 @@ class AnalyzeRule(
|
||||
|
||||
regType == jsRuleType -> {
|
||||
if (isRule(ruleParam[index])) {
|
||||
getString(arrayListOf(SourceRule(ruleParam[index]))).let {
|
||||
val ruleList = getOrCreateSingleSourceRule(ruleParam[index])
|
||||
getString(ruleList).let {
|
||||
infoVal.insert(0, it)
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user