优化链接分割规则,避免 ,{c参数} 的字符串中也存在 ,{ ,导致规则切错

修复<str0,str2,...{{js}}>这种页数列表写法中,js部分内含 < 或 > 就会切割错误的问题

优化格式化图片标签操作和匹配图片标签操作,加快图片处理速度
pull/1118/head
bushixuanqi 3 years ago
parent f6bb774465
commit 9812a01349
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  2. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -66,7 +66,7 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions {
fun setRedirectUrl(url: String): URL? {
kotlin.runCatching {
val pos = url.indexOf(',')
redirectUrl = URL( if(pos == -1)url else url.substring(pos+1).trim{ it < '!'} )
redirectUrl = URL( if(pos == -1) url else url.substring(0,pos))
}
return redirectUrl
}

@ -56,7 +56,7 @@ class AnalyzeUrl(
init {
val pos = baseUrl.indexOf(',')
if(pos != -1)baseUrl = baseUrl.substring(0,pos).trim { it < '!' }
if(pos != -1)baseUrl = baseUrl.substring(0,pos)
headerMapF?.let {
headerMap.putAll(it)
if (it.containsKey("proxy")) {
@ -160,7 +160,7 @@ class AnalyzeUrl(
var pos = ruleUrl.indexOf(',')
urlHasQuery = if(pos == -1) ruleUrl else ruleUrl.substring(0,pos).trim{ it < '!'}
urlHasQuery = if(pos == -1) ruleUrl else ruleUrl.substring(0,pos)
url = NetworkUtils.getAbsoluteURL(baseUrl,urlHasQuery )

Loading…
Cancel
Save