From 8e3b3df458bda700d91bb3d030df48405cc29c72 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Tue, 8 Mar 2022 09:37:45 +0800 Subject: [PATCH 1/3] fix:update web --- app/src/main/assets/web/bookSource/index.html | 4 ++-- app/src/main/assets/web/rssSource/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/web/bookSource/index.html b/app/src/main/assets/web/bookSource/index.html index 104fc3174..c3b6a4389 100644 --- a/app/src/main/assets/web/bookSource/index.html +++ b/app/src/main/assets/web/bookSource/index.html @@ -4,7 +4,7 @@ 阅读3.0源编辑器_V4.0 - + @@ -25,7 +25,7 @@
源类型 :
+ placeholder="<必填>0:文本 1:音频 2:图片">
源名称 :
diff --git a/app/src/main/assets/web/rssSource/index.html b/app/src/main/assets/web/rssSource/index.html index 8e5d9161e..003c7ee98 100644 --- a/app/src/main/assets/web/rssSource/index.html +++ b/app/src/main/assets/web/rssSource/index.html @@ -4,7 +4,7 @@ 阅读3.0订阅源编辑器_V4.0 - + From 5c1deb66c3df2778c34a10a3d691d7d63172e926 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Tue, 8 Mar 2022 09:40:53 +0800 Subject: [PATCH 2/3] fix:booktype mismatch --- app/src/main/java/io/legado/app/constant/BookType.kt | 2 +- app/src/main/java/io/legado/app/data/entities/BookSource.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/constant/BookType.kt b/app/src/main/java/io/legado/app/constant/BookType.kt index 470f48999..848884275 100644 --- a/app/src/main/java/io/legado/app/constant/BookType.kt +++ b/app/src/main/java/io/legado/app/constant/BookType.kt @@ -5,7 +5,7 @@ import androidx.annotation.IntDef object BookType { const val default = 0 // 0 文本 const val audio = 1 // 1 音频 - const val image = 3 //图片 + const val image = 2 //图片 const val local = "loc_book" @Target(AnnotationTarget.VALUE_PARAMETER) 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 31650756c..d00d6b98e 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 @@ -26,7 +26,7 @@ data class BookSource( var bookSourceName: String = "", // 分组 var bookSourceGroup: String? = null, - // 类型,0 文本,1 音频, 3 图片 + // 类型,0 文本,1 音频, 2 图片 @BookType.Type var bookSourceType: Int = 0, // 详情页url正则 From f94ccd55ae3b6d522d8a7933ddd19f128e5534de Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sun, 13 Mar 2022 08:28:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E4=B9=A6=E6=BA=90=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=8F=AF=E8=AF=86=E5=88=ABjs=E9=94=99=E8=AF=AF,=E5=85=B6?= =?UTF-8?q?=E4=BD=99=E5=8E=9F=E5=9B=A0=E8=A7=86=E4=B8=BA=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/help/SourceMBookHelp.md | 2 +- .../java/io/legado/app/service/CheckSourceService.kt | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/assets/help/SourceMBookHelp.md b/app/src/main/assets/help/SourceMBookHelp.md index facca613f..ae6371552 100644 --- a/app/src/main/assets/help/SourceMBookHelp.md +++ b/app/src/main/assets/help/SourceMBookHelp.md @@ -24,6 +24,6 @@ * 校验所选 * 校验书源可批量校验书源,由于网络等原因结果仅限参考 * "校验成功"是指所选的校验项目全部通过 - * 可正常识别搜索为空、发现为空、搜索(发现)目录为空、搜索(发现)正文为空、校验超时导致的失效,其余原因(网站异常、源码变动)导致的视为规则失效 + * 可正常识别搜索为空、发现为空、搜索(发现)目录为空、搜索(发现)正文为空、校验超时、js执行错误导致的失效,其余的原因视为网站失效 * 校验搜索优先使用书源填写的校验关键词,不存在时使用用户输入的关键词 * 校验结束后会自动筛选"失效"书源 \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index 37f0c27d4..74930f94b 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -24,6 +24,8 @@ import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.launch import java.util.concurrent.Executors import kotlin.math.min +import org.mozilla.javascript.WrappedException +import javax.script.ScriptException /** * 校验书源 @@ -176,18 +178,15 @@ class CheckSourceService : BaseService() { }.timeout(CheckSource.timeout) .onError(searchCoroutine) { when(it) { - //校验超时不能正常实现 不能识别 is TimeoutCancellationException -> source.addGroup("校验超时") - //NoStackTraceException 已经添加了分组,其余的视为规则失效 - !is NoStackTraceException -> source.addGroup("规则失效") + is ScriptException, is WrappedException -> source.addGroup("js失效") + !is NoStackTraceException -> source.addGroup("网站失效") } source.bookSourceComment = "Error: ${it.localizedMessage}" + if (source.bookSourceComment.isNullOrBlank()) "" else "\n\n${source.bookSourceComment}" Debug.updateFinalMessage(source.bookSourceUrl, "校验失败:${it.localizedMessage}") }.onSuccess(searchCoroutine) { - source.removeGroup("失效") - source.removeGroup("规则失效") source.removeGroup("校验超时") Debug.updateFinalMessage(source.bookSourceUrl, "校验成功") }.onFinally(IO) { @@ -230,7 +229,6 @@ class CheckSourceService : BaseService() { when (it) { is ContentEmptyException -> source.addGroup("${bookType}正文失效") is TocEmptyException -> source.addGroup("${bookType}目录失效") - //超时 网站异常 源码改变 else -> throw it } }.onSuccess {