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/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 - + 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 1e2c5ecf8..226830295 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正则 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 {