From 27c31bf0c0c3262755d30da746388748bc3e76fd Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sun, 10 Apr 2022 18:26:49 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:java.ajax=20=E6=AD=A3=E6=96=87=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=9A=84=E7=BC=BA=E7=9C=81headers=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7:=E4=B9=A6=E6=BA=90>=E5=85=A8=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index c14543cc8..cc0d64a39 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -73,7 +73,7 @@ class AnalyzeUrl( init { val urlMatcher = paramPattern.matcher(baseUrl) if (urlMatcher.find()) baseUrl = baseUrl.substring(0, urlMatcher.start()) - headerMapF?.let { + (headerMapF ?: source?.getHeaderMap(true))?.let { headerMap.putAll(it) if (it.containsKey("proxy")) { proxy = it["proxy"] From 3f49ef95ffb2b70891256ee2c0beffa91b9745bb Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sun, 10 Apr 2022 18:48:39 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=E6=90=9C=E7=B4=A2=E5=B0=81=E9=9D=A2,?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=B0=81=E9=9D=A2,=E5=B0=81=E9=9D=A2?= =?UTF-8?q?=E6=8D=A2=E6=BA=90=E7=9A=84=E7=BC=BA=E7=9C=81headers=E7=9A=84?= =?UTF-8?q?=E4=BC=98=E5=85=88=E7=BA=A7:=E4=B9=A6=E6=BA=90>=E5=85=A8?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/glide/ImageLoader.kt | 6 ++++-- .../java/io/legado/app/ui/book/changecover/CoverAdapter.kt | 2 +- .../java/io/legado/app/ui/book/info/BookInfoActivity.kt | 2 +- .../main/java/io/legado/app/ui/book/search/SearchAdapter.kt | 5 +++-- .../java/io/legado/app/ui/widget/image/CoverImageView.kt | 5 +++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt index aca00cd6a..ea4163da4 100644 --- a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt @@ -7,6 +7,7 @@ import android.net.Uri import androidx.annotation.DrawableRes import com.bumptech.glide.RequestBuilder import io.legado.app.constant.AppPattern.dataUriRegex +import io.legado.app.data.appDb import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.isAbsUrl import io.legado.app.utils.isContentScheme @@ -18,7 +19,7 @@ object ImageLoader { /** * 自动判断path类型 */ - fun load(context: Context, path: String?): RequestBuilder { + fun load(context: Context, path: String?, sourceOrigin: String? = null): RequestBuilder { return when { path.isNullOrEmpty() -> GlideApp.with(context).load(path) dataUriRegex.find(path) != null -> { @@ -27,7 +28,8 @@ object ImageLoader { } path.isAbsUrl() -> { kotlin.runCatching { - val url = AnalyzeUrl(path).getGlideUrl() + val source = sourceOrigin?.let { appDb.bookSourceDao.getBookSource(it) } + val url = AnalyzeUrl(path, source = source).getGlideUrl() GlideApp.with(context).load(url) }.getOrDefault( GlideApp.with(context).load(path) diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt index 323dbfc05..92b90ac94 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/CoverAdapter.kt @@ -35,7 +35,7 @@ class CoverAdapter(context: Context, val callBack: CallBack) : item: SearchBook, payloads: MutableList ) = binding.run { - ivCover.load(item.coverUrl, item.name, item.author) + ivCover.load(item.coverUrl, item.name, item.author, false, item.origin) tvSource.text = item.originName } diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 9cf8fa8f5..cac6831f6 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -220,7 +220,7 @@ class BookInfoActivity : } private fun showCover(book: Book) { - binding.ivCover.load(book.getDisplayCover(), book.name, book.author) + binding.ivCover.load(book.getDisplayCover(), book.name, book.author, false, book.origin) BookCover.loadBlur(this, book.getDisplayCover()) .into(binding.bgBook) } diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt index 7e4146a4c..f31dea1ff 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt @@ -86,7 +86,8 @@ class SearchAdapter(context: Context, val callBack: CallBack) : searchBook.coverUrl, searchBook.name, searchBook.author, - AppConfig.loadOnlyWifi + AppConfig.loadOnlyWifi, + searchBook.origin ) } } @@ -99,7 +100,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) : "last" -> upLasted(binding, searchBook.latestChapterTitle) "intro" -> tvIntroduce.text = searchBook.trimIntro(context) "kind" -> upKind(binding, searchBook.getKindList()) - "cover" -> ivCover.load(searchBook.coverUrl, searchBook.name, searchBook.author) + "cover" -> ivCover.load(searchBook.coverUrl, searchBook.name, searchBook.author, false, searchBook.origin) } } } diff --git a/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt index 61b0baebe..995b1a120 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt @@ -175,7 +175,8 @@ class CoverImageView @JvmOverloads constructor( path: String? = null, name: String? = null, author: String? = null, - loadOnlyWifi: Boolean = false + loadOnlyWifi: Boolean = false, + sourceOrigin: String? = null ) { this.bitmapPath = path this.name = name?.replace(AppPattern.bdRegex, "")?.trim() @@ -186,7 +187,7 @@ class CoverImageView @JvmOverloads constructor( .centerCrop() .into(this) } else { - ImageLoader.load(context, path)//Glide自动识别http://,content://和file:// + ImageLoader.load(context, path, sourceOrigin)//Glide自动识别http://,content://和file:// .apply(RequestOptions().set(OkHttpModelLoader.loadOnlyWifiOption, loadOnlyWifi)) .placeholder(BookCover.defaultDrawable) .error(BookCover.defaultDrawable) From 6ecb62177be749bc3744ab81160471baff0a195e Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sun, 10 Apr 2022 20:45:19 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=E8=AE=A2=E9=98=85=E6=BA=90=E5=B0=81?= =?UTF-8?q?=E9=9D=A2,icon=E7=9A=84=E7=BC=BA=E7=9C=81headers=E7=9A=84?= =?UTF-8?q?=E4=BC=98=E5=85=88=E7=BA=A7:=E4=B9=A6=E6=BA=90>=E5=85=A8?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/glide/ImageLoader.kt | 4 +++- app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt | 2 +- .../java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt | 2 +- .../java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt | 2 +- .../java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt | 2 +- .../io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt index ea4163da4..b60131995 100644 --- a/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/glide/ImageLoader.kt @@ -28,7 +28,9 @@ object ImageLoader { } path.isAbsUrl() -> { kotlin.runCatching { - val source = sourceOrigin?.let { appDb.bookSourceDao.getBookSource(it) } + val source = sourceOrigin?.let { + appDb.bookSourceDao.getBookSource(it) ?: appDb.rssSourceDao.getByKey(it) + } val url = AnalyzeUrl(path, source = source).getGlideUrl() GlideApp.with(context).load(url) }.getOrDefault( diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt index b3df28b0d..0fa56a4a4 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt @@ -27,7 +27,7 @@ class RssAdapter(context: Context, val callBack: CallBack) : ) { binding.apply { tvName.text = item.sourceName - ImageLoader.load(context, item.sourceIcon) + ImageLoader.load(context, item.sourceIcon, item.sourceUrl) .centerCrop() .placeholder(R.drawable.image_rss) .error(R.drawable.image_rss) diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt index b2d14e9f1..85c39d029 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt @@ -38,7 +38,7 @@ class RssArticlesAdapter(context: Context, callBack: CallBack) : if (item.image.isNullOrBlank() && !callBack.isGridLayout) { imageView.gone() } else { - ImageLoader.load(context, item.image).apply { + ImageLoader.load(context, item.image, item.origin).apply { if (callBack.isGridLayout) { placeholder(R.drawable.image_rss_article) } else { diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt index d92fb4b94..40a53984d 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter1.kt @@ -36,7 +36,7 @@ class RssArticlesAdapter1(context: Context, callBack: CallBack) : if (item.image.isNullOrBlank() && !callBack.isGridLayout) { imageView.gone() } else { - ImageLoader.load(context, item.image).apply { + ImageLoader.load(context, item.image, item.origin).apply { if (callBack.isGridLayout) { placeholder(R.drawable.image_rss_article) } else { diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt index 5a512a063..99f892bda 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter2.kt @@ -36,7 +36,7 @@ class RssArticlesAdapter2(context: Context, callBack: CallBack) : if (item.image.isNullOrBlank() && !callBack.isGridLayout) { imageView.gone() } else { - ImageLoader.load(context, item.image).apply { + ImageLoader.load(context, item.image, item.origin).apply { if (callBack.isGridLayout) { placeholder(R.drawable.image_rss_article) } else { diff --git a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt index ba0a252c2..25cde23c0 100644 --- a/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/favorites/RssFavoritesAdapter.kt @@ -35,7 +35,7 @@ class RssFavoritesAdapter(context: Context, val callBack: CallBack) : if (item.image.isNullOrBlank()) { imageView.gone() } else { - ImageLoader.load(context, item.image) + ImageLoader.load(context, item.image, item.origin) .addListener(object : RequestListener { override fun onLoadFailed( e: GlideException?, From e9e8dc2514cd8b30cebb492ac21b88b1f3ca7199 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sun, 10 Apr 2022 23:51:08 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(=E5=8F=91=E7=8E=B0=E5=B0=81=E9=9D=A2):?= =?UTF-8?q?=E4=B9=A6=E6=BA=90headers=E4=BC=98=E5=85=88=E7=BA=A7>=E5=85=A8?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt index f8702072f..dc85cca72 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt @@ -43,7 +43,7 @@ class ExploreShowAdapter(context: Context, val callBack: CallBack) : llKind.visible() llKind.setLabels(kinds) } - ivCover.load(item.coverUrl, item.name, item.author, AppConfig.loadOnlyWifi) + ivCover.load(item.coverUrl, item.name, item.author, AppConfig.loadOnlyWifi, item.origin) } } From 32b66fef5101a874c380555343b73967020f44d7 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 11 Apr 2022 10:55:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(=E4=B9=A6=E6=9E=B6=E5=B0=81=E9=9D=A2):h?= =?UTF-8?q?eaders=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt | 4 ++-- .../app/ui/main/bookshelf/style1/books/BooksAdapterList.kt | 4 ++-- .../legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt | 4 ++-- .../legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt index 93be8e464..b2c2211e0 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt @@ -27,13 +27,13 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) : val bundle = payloads.getOrNull(0) as? Bundle if (bundle == null) { tvName.text = item.name - ivCover.load(item.getDisplayCover(), item.name, item.author) + ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) upRefresh(binding, item) } else { bundle.keySet().forEach { when (it) { "name" -> tvName.text = item.name - "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) "refresh" -> upRefresh(binding, item) } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterList.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterList.kt index 3d19dc36f..91f1173e1 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterList.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksAdapterList.kt @@ -30,7 +30,7 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : tvAuthor.text = item.author tvRead.text = item.durChapterTitle tvLast.text = item.latestChapterTitle - ivCover.load(item.getDisplayCover(), item.name, item.author) + ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) upRefresh(binding, item) } else { tvRead.text = item.durChapterTitle @@ -39,7 +39,7 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : when (it) { "name" -> tvName.text = item.name "author" -> tvAuthor.text = item.author - "cover" -> ivCover.load(item.getDisplayCover()) + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) "refresh" -> upRefresh(binding, item) } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt index c82cf3d18..d62700156 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt @@ -63,7 +63,7 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) : bundle.keySet().forEach { when (it) { "name" -> tvName.text = item.name - "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) "refresh" -> upRefresh(this, item) } } @@ -98,7 +98,7 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) : val item = callBack.getItem(position) if (item is Book) { tvName.text = item.name - ivCover.load(item.getDisplayCover(), item.name, item.author) + ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) upRefresh(this, item) } root.setOnClickListener { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt index f7364fc68..456f367e0 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt @@ -64,7 +64,7 @@ class BooksAdapterList(context: Context, callBack: CallBack) : when (it) { "name" -> tvName.text = item.name "author" -> tvAuthor.text = item.author - "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) "refresh" -> upRefresh(this, item) } } @@ -109,7 +109,7 @@ class BooksAdapterList(context: Context, callBack: CallBack) : tvAuthor.text = item.author tvRead.text = item.durChapterTitle tvLast.text = item.latestChapterTitle - ivCover.load(item.getDisplayCover(), item.name, item.author) + ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin) flHasNew.visible() ivAuthor.visible() ivLast.visible() From b8d715419d7c69601c7c2b1f10324e7a7bfa97e1 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 11 Apr 2022 12:22:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat:java.webView=20headers=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E8=B0=83=E6=95=B4=E4=B8=8B=EF=BC=9B=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/help/jsHelp.md | 19 +++++++++++++++++-- .../java/io/legado/app/help/JsExtensions.kt | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/help/jsHelp.md b/app/src/main/assets/help/jsHelp.md index b6b0a3c79..1d2ae5eaa 100644 --- a/app/src/main/assets/help/jsHelp.md +++ b/app/src/main/assets/help/jsHelp.md @@ -51,8 +51,17 @@ java.put(key, value) ``` * 网络请求 ``` -java.ajax(urlStr) +java.ajax(urlStr): String java.ajaxAll(urlList: Array): Array +//返回Response 方法body() code() message() header() raw() toString() +java.connect(urlStr): Response + +* 使用webView访问网络 +* @param html 直接用webView载入的html, 如果html为空直接访问url +* @param url html内如果有相对路径的资源不传入url访问不了 +* @param js 用来取返回值的js语句, 没有就返回整个源代码 +* @return 返回js获取的内容 +java.webView(html: String?, url: String?, js: String?): String ``` * 调试 ``` @@ -142,7 +151,8 @@ java.md5Encode(str) java.md5Encode16(str) ``` -## book对象的可用属性 +## book对象的可用属性和方法 +### 属性 > 使用方法: 在js中或{{}}中使用book.属性的方式即可获取.如在正文内容后加上 ##{{book.name+"正文卷"+title}} 可以净化 书名+正文卷+章节名称(如 我是大明星正文卷第二章我爸是豪门总裁) 这一类的字符. ``` bookUrl // 详情页Url(本地书源存储完整文件路径) @@ -174,6 +184,11 @@ order // 手动排序 originOrder //书源排序 variable // 自定义书籍变量信息(用于书源规则检索书籍信息) ``` +### 方法 +``` +//可在正文js中关闭净化 对于漫画源有用 +book.setUseReplaceRule(boolean) +``` ## chapter对象的部分可用属性 > 使用方法: 在js中或{{}}中使用chapter.属性的方式即可获取.如在正文内容后加上 ##{{chapter.title+chapter.index}} 可以净化 章节标题+序号(如 第二章 天仙下凡2) 这一类的字符. 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 5314ea84a..0e548a43b 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -123,7 +123,9 @@ interface JsExtensions { BackstageWebView( url = url, html = html, - javaScript = js + javaScript = js, + headerMap = getSource()?.getHeaderMap(true), + tag = getSource()?.getKey() ).getStrResponse().body } }