kunfei 4 سال پیش
والد
کامیت
4b375fb33d

+ 4 - 1
app/src/main/assets/updateLog.md

@@ -11,9 +11,12 @@
 * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
 
-**2022/04/08**
+**2022/04/012**
 
 * 恢复epub加载方式
+* 添加替换超时判断,替换超时自动禁用替换规则并重启应用,正则无限执行会导致耗电异常且没有办法主动结束线程只能重启应用
+* 使用glide解码正文图片 by Xwite
+* fix:缓存图片后缀错误拼接 by Xwite
 
 **2022/04/07**
 

+ 3 - 0
app/src/main/java/io/legado/app/exception/RegexTimeoutException.kt

@@ -0,0 +1,3 @@
+package io.legado.app.exception
+
+class RegexTimeoutException(msg: String) : NoStackTraceException(msg)

+ 3 - 3
app/src/main/java/io/legado/app/help/ContentProcessor.kt

@@ -6,9 +6,9 @@ import io.legado.app.data.appDb
 import io.legado.app.data.entities.Book
 import io.legado.app.data.entities.BookChapter
 import io.legado.app.data.entities.ReplaceRule
+import io.legado.app.exception.RegexTimeoutException
 import io.legado.app.help.config.AppConfig
 import io.legado.app.help.config.ReadBookConfig
-import io.legado.app.utils.RegexTimeoutException
 import io.legado.app.utils.msg
 import io.legado.app.utils.replace
 import io.legado.app.utils.toastOnUi
@@ -137,7 +137,7 @@ class ContentProcessor private constructor(
             if (item.pattern.isNotEmpty()) {
                 kotlin.runCatching {
                     mContent = if (item.isRegex) {
-                        mContent.replace(item.pattern.toRegex(), item.replacement, 1000L)
+                        mContent.replace(item.pattern.toRegex(), item.replacement, 2000L)
                     } else {
                         mContent.replace(item.pattern, item.replacement)
                     }
@@ -146,7 +146,7 @@ class ContentProcessor private constructor(
                         is RegexTimeoutException -> {
                             item.isEnabled = false
                             appDb.replaceRuleDao.update(item)
-                            return it.msg
+                            return item.name + it.msg
                         }
                         else -> {
                             AppLog.put("${item.name}替换出错\n${it.localizedMessage}", it)

+ 1 - 2
app/src/main/java/io/legado/app/utils/RegexExtensions.kt

@@ -1,6 +1,6 @@
 package io.legado.app.utils
 
-import io.legado.app.exception.NoStackTraceException
+import io.legado.app.exception.RegexTimeoutException
 import io.legado.app.help.CrashHandler
 import kotlinx.coroutines.suspendCancellableCoroutine
 import splitties.init.appCtx
@@ -34,4 +34,3 @@ suspend fun CharSequence.replace(regex: Regex, replacement: String, timeout: Lon
     }
 }
 
-class RegexTimeoutException(msg: String) : NoStackTraceException(msg)