94 lines
3.0 KiB
Markdown
94 lines
3.0 KiB
Markdown
# 起点读书签到 Autman 插件
|
||
|
||
起点读书(QDReader)Autman 签到插件。QX 只负责抓取 Cookie,签到由本插件在 Autman 内完成。
|
||
|
||
## 文件位置
|
||
|
||
正式插件文件:
|
||
|
||
```text
|
||
plugins/qdreader/qdreader_sign_autman.js
|
||
```
|
||
|
||
实机 JS 导入副本:
|
||
|
||
```text
|
||
js/qdreader_sign_autman.js
|
||
```
|
||
|
||
Raw 链接:
|
||
|
||
```text
|
||
https://gitea.chickliu.fun/Hermes/autman-plugins/raw/branch/main/plugins/qdreader/qdreader_sign_autman.js
|
||
https://gitea.chickliu.fun/Hermes/autman-plugins/raw/branch/main/js/qdreader_sign_autman.js
|
||
```
|
||
|
||
## 功能
|
||
|
||
- QX 抓到 Cookie 后,把 `起点ck <cookie>` 发给 Autman 保存。
|
||
- 手动全部签到:`起点签到`。
|
||
- 手动单账号签到:`起点签到 <uid>`。
|
||
- 定时签到:头注 `//[cron: 15 7 * * *]`,每日 07:15 自动签到。
|
||
- 查询/维护:`起点ck 查询`、`起点ck 导出`、`起点ck 删除 <uid|all>`。
|
||
- 签到结果按成功/失败汇总;普通状态输出 uid 会脱敏,导出命令除外。
|
||
|
||
## v2.2.0 优化点
|
||
|
||
- 存储兼容:同时兼容 `get/set` 和 `bucketGet/bucketSet("otto", key)`。
|
||
- 消息兼容:兼容 `getContent/GetContent/input/sender.getContent/sender.getMessage`。
|
||
- 请求兼容:兼容 `request/$request`,并统一解析 `body/data` JSON。
|
||
- 签名兼容:兼容 `{code:0,data:{headers:{...}}}`、`{code:200,data:{...}}`、`{headers:{...}}` 等签名网关返回形态。
|
||
- 网络健壮性:新增 `otto.qdreader_retry_count`,默认重试 1 次,最大 3 次。
|
||
- 定时体验:新增 `otto.qdreader_cron_silent`,可让定时触发且无账号时静默。
|
||
- 安全脱敏:保存/查询/签到结果不直接输出完整 Cookie;`导出` 是管理员主动行为,会输出完整 JSON。
|
||
- 测试覆盖:`tests/qdreader_plugin.test.mjs` 覆盖手动、定时、bucket 存储、重试、查询脱敏、删除全部。
|
||
|
||
## 配置
|
||
|
||
Autman 参数:
|
||
|
||
```text
|
||
otto.qdreader_cookie_json = {"uid":"cookie"}
|
||
otto.qdreader_sign_api = https://api.120399.xyz
|
||
otto.qdreader_retry_count = 1
|
||
otto.qdreader_cron_silent = false
|
||
```
|
||
|
||
说明:
|
||
|
||
- `qdreader_cookie_json`:机器人命令维护,JSON Map 格式。
|
||
- `qdreader_sign_api`:兼容 `/sign` 的签名网关,默认 `https://api.120399.xyz`。
|
||
- `qdreader_retry_count`:请求异常重试次数,默认 1,范围 0-3。
|
||
- `qdreader_cron_silent`:`true` 时,如果定时触发但没有账号,不发送提醒。
|
||
|
||
## 命令
|
||
|
||
```text
|
||
起点ck <QX抓到的完整cookie>
|
||
起点ck json {"uid":"cookie"}
|
||
起点ck 查询
|
||
起点ck 导出
|
||
起点ck 删除 <uid>
|
||
起点ck 删除 all
|
||
起点签到
|
||
起点签到 <uid>
|
||
qdreader sign
|
||
```
|
||
|
||
## 签名与签到流程
|
||
|
||
签名与签到流程沿用上游 QDReader:
|
||
|
||
1. 从 Cookie 解析 `QDHeader/qdh/uid/guid/qimei/qimei36`。
|
||
2. `POST https://api.120399.xyz/sign` 获取起点请求签名头。
|
||
3. `POST https://h5.if.qidian.com/argus/api/v3/checkin/checkin` 完成签到。
|
||
4. 汇总每个账号签到结果。
|
||
|
||
## 本地验证
|
||
|
||
```bash
|
||
node -c plugins/qdreader/qdreader_sign_autman.js
|
||
node -c js/qdreader_sign_autman.js
|
||
node tests/qdreader_plugin.test.mjs
|
||
```
|