From 0a4fbff93e2ab935f1691dc58d89054944d04af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E9=B8=9F=E9=98=9F=E5=91=98?= Date: Wed, 16 Dec 2020 15:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/constant/AppConst.kt | 5 ++--- app/src/main/java/io/legado/app/help/JsExtensions.kt | 8 +++++--- app/src/main/java/io/legado/app/model/webBook/BookInfo.kt | 2 +- app/src/main/java/io/legado/app/model/webBook/BookList.kt | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index 835862fc0..b474863fb 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -36,9 +36,8 @@ object AppConst { val keyboardToolChars: List by lazy { arrayListOf( - "❓", "@", "&", "|", "%", "/", "\\", ":", "[", "]", "{", "}", "<", ">", - "$", "#", "!", ".", "+", "-", "*", "=", "href", "src", "textNodes", "xpath", "json", - "css", "id", "class", "tag" + "❓", "@css:", "", "{{}}", "&&", "%%", "||", "//", "$.", "@", "class", "id", "href", + "textNodes", "ownText", "all", "html", "[", "]", "<", ">","#", "!", ".", "+", "-", "*", "=" ) } diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 825141793..1c112ec9c 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -57,7 +57,7 @@ interface JsExtensions { * 实现文件下载,返回路径 */ fun downloadFile(content: String, url: String): String { - val type = AnalyzeUrl(url).type ?: return "type为空,未下载" + val type = AnalyzeUrl(url).type ?: return "" val zipPath = FileUtils.getPath( FileUtils.createFolderIfNotExist(FileUtils.getCachePath()), "${MD5Utils.md5Encode16(url)}.${type}" @@ -76,6 +76,7 @@ interface JsExtensions { * js实现压缩文件解压 */ fun unzipFile(zipPath: String): String { + if (zipPath.isEmpty()) return "" val unzipPath = FileUtils.getPath( FileUtils.createFolderIfNotExist(FileUtils.getCachePath()), FileUtils.getNameExcludeExtension(zipPath) @@ -92,6 +93,7 @@ interface JsExtensions { * js实现文件夹内所有文件读取 */ fun getTxtInFolder(unzipPath: String): String { + if (unzipPath.isEmpty()) return "" val unzipFolder = FileUtils.createFolderIfNotExist(unzipPath) val contents = StringBuilder() unzipFolder.listFiles().let { @@ -109,7 +111,7 @@ interface JsExtensions { } /** - * js实现重定向拦截,不能删 + * js实现重定向拦截,网络访问get */ fun get(urlStr: String, headers: Map): Connection.Response { return Jsoup.connect(urlStr) @@ -279,7 +281,7 @@ interface JsExtensions { val oldCode = s.toInt() if (font1.InLimit(s)) { val code = font2.GetCodeByGlyf(font1.GetGlyfByCode(oldCode)) - if(code != 0) contentArray[index] = code.toChar() + if (code != 0) contentArray[index] = code.toChar() } } return contentArray.joinToString("") diff --git a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt index 877fcf41b..877081cbc 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt @@ -70,7 +70,7 @@ object BookInfo { analyzeRule.getString(infoRule.intro).let { if (it.isNotEmpty()) book.intro = it.htmlFormat() } - Debug.log(bookSource.bookSourceUrl, "└${book.intro}", isHtml = true) + Debug.log(bookSource.bookSourceUrl, "└${book.intro}") Debug.log(bookSource.bookSourceUrl, "┌获取封面链接") analyzeRule.getString(infoRule.coverUrl).let { diff --git a/app/src/main/java/io/legado/app/model/webBook/BookList.kt b/app/src/main/java/io/legado/app/model/webBook/BookList.kt index fd2697587..464580854 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookList.kt @@ -163,7 +163,7 @@ object BookList { if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取简介") searchBook.intro = analyzeRule.getString(intro).htmlFormat() - Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", true) + Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}") if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取封面链接") searchBook.coverUrl = analyzeRule.getString(coverUrl, true) @@ -223,7 +223,7 @@ object BookList { if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取简介", log) searchBook.intro = analyzeRule.getString(ruleIntro).htmlFormat() - Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log, true) + Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log) if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取封面链接", log) analyzeRule.getString(ruleCoverUrl).let {