From b3cf0954f4d123065477734210ab58f83647145c Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sat, 15 Jan 2022 17:35:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:jsHelp.md=E9=93=BE=E6=8E=A5=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/help/jsHelp.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/help/jsHelp.md b/app/src/main/assets/help/jsHelp.md index 6d08173f9..aeeedf3f3 100644 --- a/app/src/main/assets/help/jsHelp.md +++ b/app/src/main/assets/help/jsHelp.md @@ -15,7 +15,7 @@ ## 当前类对象的可使用的部分方法 -### [AnalyzeUrl](https://github.com/gedoor/legado/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt) 部分函数 +### [AnalyzeUrl](https://github.com/gedoor/legado/blob/master/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt) 部分函数 > js中通过java.调用,只在`登录检查JS`规则中有效 ``` initUrl() //重新解析url,可以用于登录检测js登录后重新解析url重新访问 @@ -24,7 +24,7 @@ getStrResponse( jsStr: String? = null, sourceRegex: String? = null) //返回访 getResponse(): Response //返回访问结果,网络朗读引擎采用的是这个,调用登录后在调用这方法可以重新访问,参考阿里云登录检测 ``` -### [AnalyzeRule](https://github.com/gedoor/legado/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt) 部分函数 +### [AnalyzeRule](https://github.com/gedoor/legado/blob/master/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt) 部分函数 * 获取文本/文本列表 > `mContent` 待解析源代码,默认为当前页面 > `isUrl` 链接标识,默认为`false` @@ -204,7 +204,7 @@ cookie.removeCookie(key) ``` ## cache对象的部分可用函数 -> saveTime单位:秒,可省略 +> saveTime单位:秒,可省略 > 保存至数据库和缓存文件(50M),保存的内容较大时请使用`getFile putFile` ``` 保存 From dcaf183a38cf4f75d81efd95bc1153a6e8ef6225 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 17 Jan 2022 11:44:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E8=B4=AD=E4=B9=B0=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=8A=A5=E9=94=99;=E6=B7=BB=E5=8A=A0=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=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 | 9 ++++- app/src/main/assets/help/ruleHelp.md | 33 +++++++++++++++++++ app/src/main/assets/updateLog.md | 6 ++-- .../app/ui/book/read/ReadBookActivity.kt | 2 +- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/help/jsHelp.md b/app/src/main/assets/help/jsHelp.md index aeeedf3f3..804dd0d87 100644 --- a/app/src/main/assets/help/jsHelp.md +++ b/app/src/main/assets/help/jsHelp.md @@ -189,10 +189,17 @@ source.getVariable() * 登录头操作 ``` source.getLoginHeader() -source.getLoginHeaderMap(): Map? +source.getLoginHeaderMap().get(key: String) source.putLoginHeader(header: String) source.removeLoginHeader() ``` +* 用户登录信息操作 +> 使用`登录UI`规则,并成功登录,阅读自动加密保存登录UI规则中除type为button的信息 +``` +source.getLoginInfo() +source.getLoginInfoMap().get(key: String) +source.removeLoginInfo() +``` ## cookie对象的部分可用函数 ``` 获取全部cookie diff --git a/app/src/main/assets/help/ruleHelp.md b/app/src/main/assets/help/ruleHelp.md index 3ddc61526..cf6541c3f 100644 --- a/app/src/main/assets/help/ruleHelp.md +++ b/app/src/main/assets/help/ruleHelp.md @@ -11,6 +11,36 @@ : regex规则,不可省略,只可以用在书籍列表和目录列表 ``` +* 登录UI +> 不使用内置webView登录网站,需要使用`登录URL`规则实现登录逻辑,可使用`登录检查JS`检查登录结果 +``` +规则填写示范 +[ + { + name: "telephone", + type: "text" + }, + { + name: "password", + type: "password" + }, + { + name: "注册", + type: "button", + action: "http://www.yooike.com/xiaoshuo/#/register?title=%E6%B3%A8%E5%86%8C" + } +] +成功登录后在js中获取读取登录信息 +source.getLoginInfo() +source.getLoginInfoMap().get("telephone") +登录信息示范 +{ + "telephone":"123456", + "password":"123456" +} + +``` + * 发现url格式 ```json [ @@ -104,3 +134,6 @@ let options = { ``` +* 购买操作 +> 返回购买链接,可直接填写链接或者JavaScript +> 可用变量 book chapter \ No newline at end of file diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index ddd0ae7a9..1eda788b7 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,13 +11,15 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2020/01/17** +* 添加payAction规则,返回购买链接 +* 书源编辑中的辅助键盘❓中可查看js说明文档 + **2022/01/11** * 紧急修复在线tts朗读bug * 紧急修复登录问题 * 添加isVolume规则,支持二级目录,正文标题显示优化 by Xwite -* 书源编辑界面显示payAction规则 -* 书源编辑中的辅助键盘❓中可查看js说明文档 **2022/01/10** diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 4aa72b8f7..28ba6e57f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -842,7 +842,7 @@ class ReadBookActivity : BaseReadBookActivity(), startActivity { putExtra("title", getString(R.string.chapter_pay)) putExtra("url", it) - IntentData.put(it, ReadBook.bookSource) + IntentData.put(it, ReadBook.bookSource?.getHeaderMap(true)) } } }.onError {