dsh-lamplit 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE.md +21 -0
- package/README.md +162 -2
- package/client.js +4972 -0
- package/cordis.patch.yml +4 -0
- package/icon.svg +14 -0
- package/index.js +61 -0
- package/lib/ai.js +88 -0
- package/lib/api.js +749 -0
- package/lib/epub.js +209 -0
- package/lib/http.js +93 -0
- package/lib/markdown.js +233 -0
- package/lib/notes.js +155 -0
- package/lib/pdf-text.js +1814 -0
- package/lib/pdf.js +62 -0
- package/lib/providers/fanqie.js +208 -0
- package/lib/providers/weread.js +144 -0
- package/lib/store.js +506 -0
- package/lib/text-util.js +172 -0
- package/lib/txt.js +24 -0
- package/lib/vendor/weread/LICENSE +27 -0
- package/lib/vendor/weread/crypto.js +495 -0
- package/lib/vendor/weread/qr-login.js +160 -0
- package/lib/vendor/weread/qrcode-generator.cjs +2297 -0
- package/lib/vendor/weread/reader.js +469 -0
- package/lib/vendor/weread/web.js +187 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +68 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pillowbook contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
## Vendored code
|
|
4
|
+
|
|
5
|
+
`lib/vendor/weread/` 里的 `crypto.js`、`reader.js`、`web.js`、`qr-login.js`(以及它依赖的
|
|
6
|
+
`qrcode-generator.cjs`)来自 **dsh-weread 1.9.1**
|
|
7
|
+
(MIT License,作者见其仓库 `wwjzzy/dsh-weread`)。副本未改动逻辑,仅在文件头加了
|
|
8
|
+
来源说明。许可证全文见 `lib/vendor/weread/LICENSE`。
|
|
9
|
+
|
|
10
|
+
用途:读取**用户自己账号**的微信读书书架、目录与章节正文(网页版接口的签名与
|
|
11
|
+
分片解码)。这部分是协议实现,不是 UI 代码;灯下的界面与数据模型是独立实现。
|
|
12
|
+
|
|
13
|
+
## Original work
|
|
14
|
+
|
|
15
|
+
其余所有文件(Host 路由、存储、Markdown/TXT/PDF 解析、番茄来源、`client.js` 阅读器
|
|
16
|
+
界面、图标、locale)为本插件原创。
|
|
17
|
+
|
|
18
|
+
## Trademarks
|
|
19
|
+
|
|
20
|
+
「微信读书」「番茄小说」是各自权利人的商标;本插件只是用户自己账号的本地阅读客户端,
|
|
21
|
+
与两家公司无关联,也未获得其背书。
|
package/README.md
CHANGED
|
@@ -1,3 +1,163 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 灯下 · Lamplit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="assets/banner.svg" alt="灯下 Lamplit" width="100%">
|
|
4
|
+
|
|
5
|
+
**One quiet shelf for WeChat Reading, Fanqie Novel and your own books — inside [DeepSeek Harness](https://github.com/deepseek-ai).**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/dsh-lamplit)
|
|
8
|
+
[](https://github.com/lysforge/lamplit/actions/workflows/test.yml)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
灯下是 DeepSeek Harness 的一个读书插件:一个书架、一个沉浸式阅读器,把你散在三个地方的阅读收进同一盏灯下。
|
|
13
|
+
|
|
14
|
+
- **微信读书** —— 扫码登录你自己的账号,书架、目录、正文都在插件里读,不用跳浏览器
|
|
15
|
+
- **番茄小说** —— 粘一条链接就加书,目录同步;正文受平台字体加密限制,会直说,不灌乱码
|
|
16
|
+
- **自己的文件** —— Markdown / TXT / EPUB / PDF 直接导入;扫描版 PDF 走页面渲染,不硬抽文字
|
|
17
|
+
|
|
18
|
+
> 名字取自「灯下夜读」。这个插件不推送、不社交、不做阅读时长排行,只负责让一本书在你面前摊开。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Why another reader
|
|
23
|
+
|
|
24
|
+
Harness 里已经有聊天、有终端、有文件系统。读书这事缺的从来不是「再一个阅读器」,而是这三件事:
|
|
25
|
+
|
|
26
|
+
1. **你的书不在一处**:微信读书一个 App、番茄一个、下载的 PDF 一个文件夹。
|
|
27
|
+
2. **进度记不住**:本地阅读器读完关掉,下次还得自己找位置。
|
|
28
|
+
3. **想留住一句话**:划线要另开笔记软件,读完就散了。
|
|
29
|
+
|
|
30
|
+
灯下把这三件事塞进一个面板:统一书架、按章记进度、选中就能问 AI 并存成笔记。
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
| | |
|
|
35
|
+
|---|---|
|
|
36
|
+
| 📚 **一个书架** | 微信读书 / 番茄 / 本地文件混排,封面网格 + 继续阅读条,来源筛选与排序 |
|
|
37
|
+
| 🔐 **用你自己的账号** | 微信读书扫码即登(Cookie 只落本机),番茄免登录加书 |
|
|
38
|
+
| 📖 **沉浸阅读** | 四套纸张主题(纸白 / 米黄 / 夜墨 / 护眼)、衬线限宽、分页与滚动双模式、目录抽屉、工具条自动淡出、键盘翻页 |
|
|
39
|
+
| 🖍 **划词 AI** | 选中一段 → 解释 / 补充 / 记笔记 / 复制,走 Harness 当前默认模型,结果可存为笔记 |
|
|
40
|
+
| 🗂 **笔记** | 按书分组,点引文跳回正文那一句,可导出 Markdown(本书 / 全部) |
|
|
41
|
+
| 📄 **导入** | Markdown(按标题切章)、TXT(按「第 X 章」切章)、EPUB(自研 ZIP + OPF/spine)、PDF(有文字层则排版,扫描件则页面渲染) |
|
|
42
|
+
| 📊 **统计** | 今日 / 本周 / 总计 / 连续天数 / 读完本数,7 天柱状图,数据只在本机 |
|
|
43
|
+
| 🎯 **零依赖** | Host 与 Client 都是纯 JS;PDF 抽取、EPUB 解析、二维码渲染全部自己实现 |
|
|
44
|
+
|
|
45
|
+
## 支持矩阵(实话实说)
|
|
46
|
+
|
|
47
|
+
| 能力 | 状态 | 说明 |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| 微信读书 · 书架/目录/正文 | ✅ | 扫码后自动同步书架;打开书时按需拉目录,章节正文懒加载并缓存 |
|
|
50
|
+
| 微信读书 · 站内找书 | ✅ | 已登录时可在来源面板搜索并加入书架 |
|
|
51
|
+
| 微信读书 · 云端进度 | 只读 | 能读到你账号的进度,但**不回写**(不伪造阅读时长) |
|
|
52
|
+
| 番茄小说 · 目录/书名/封面 | ✅ | 粘 `fanqienovel.com/page/<id>` 即可 |
|
|
53
|
+
| 番茄小说 · 正文 | ⚠️ 多数不可读 | 免费正文被平台换成私用区字形(字体反爬)。抓到混淆文本时接口返回 `code: OBFUSCATED`,界面引导去官方 App 读或用「粘贴正文」导入 |
|
|
54
|
+
| 番茄小说 · 搜索 | ❌ | 接口带滑块验证,插件不绕它 |
|
|
55
|
+
| MOBI / AZW3 / KFX | ❌ | 亚马逊私有容器(KFX 带 DRM),先用 Calibre 转 EPUB |
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
**在 Harness 里装(推荐)**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
插件(Plugins)→ 安装 → 输入 dsh-lamplit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
或者命令行(npm 上是 `dsh-lamplit@0.1.1`,带 SLSA provenance):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dsh plugin --profile desktop add dsh-lamplit
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**装不上 npm 时用 Release 附件**
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
dsh plugin --profile <profile> add https://github.com/lysforge/lamplit/releases/download/v0.1.1/dsh-lamplit-0.1.1.tgz
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**从源码装**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git clone https://github.com/lysforge/lamplit.git
|
|
81
|
+
cd lamplit && node --test test/*.test.mjs # 24 项通过再装
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
然后在 Harness 的插件页用「从本地目录安装」选中这个目录。装完 ⌘R 刷新,左侧图标栏多一盏灯。
|
|
85
|
+
|
|
86
|
+
## 第一次用
|
|
87
|
+
|
|
88
|
+
1. 点左侧「灯下」→ 顶栏 **导入**,把 `.md / .txt / .epub / .pdf` 拖进书架。
|
|
89
|
+
2. 想在灯下里读微信读书:顶栏 **来源** → 微信读书 → **用微信扫码登录**,扫完自动同步书架。
|
|
90
|
+
3. 点开任意一本开始读。选中正文任一段,浮出工具条:解释 / 补充 / 记笔记 / 复制。
|
|
91
|
+
|
|
92
|
+
## 数据与隐私
|
|
93
|
+
|
|
94
|
+
- 所有数据在 `~/.dsh/lamplit/`:`state.json`(设置 + 书目 + 凭据)、`books/<id>.json`(正文)、`notes.json`、`files/`(影印 PDF 原件)。
|
|
95
|
+
- 文件权限 `0600`,Cookie **不会**回显到界面,也不会离开本机。
|
|
96
|
+
- 没有遥测、没有账号体系、不上传任何内容。插件只在你的明确操作下访问 `weread.qq.com` / `fanqienovel.com`。
|
|
97
|
+
|
|
98
|
+
## 结构
|
|
99
|
+
|
|
100
|
+
```mermaid
|
|
101
|
+
flowchart LR
|
|
102
|
+
UI[client.js<br/>书架 · 阅读器 · 笔记] -- 同源 fetch --> API[lib/api.js<br/>/lamplit/api/*]
|
|
103
|
+
API --> Store[(~/.dsh/lamplit<br/>state · books · notes)]
|
|
104
|
+
API --> Weread[微信读书<br/>扫码 / 书架 / 正文]
|
|
105
|
+
API --> Fanqie[番茄小说<br/>目录]
|
|
106
|
+
API --> Parser[MD / TXT / EPUB / PDF]
|
|
107
|
+
API --> LLM[Harness llm<br/>划词解释]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| 文件 | 作用 |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `index.js` | Host 入口:把 `/lamplit/*` 挂到宿主 webServer(handler 路由,支持 POST/DELETE) |
|
|
113
|
+
| `lib/api.js` | 全部接口:state / import / book / chapter / progress / notes / ai / provider |
|
|
114
|
+
| `lib/store.js` | 原子写、`0600`、批量入库、按日统计 |
|
|
115
|
+
| `lib/markdown.js` `lib/txt.js` `lib/epub.js` `lib/pdf.js` `lib/pdf-text.js` | 四种格式的解析;PDF 抽取零依赖(Flate + ToUnicode CMap) |
|
|
116
|
+
| `lib/providers/*.js` | 两个来源的适配器 |
|
|
117
|
+
| `lib/ai.js` | 划词 AI,复用宿主 `llm` 服务 |
|
|
118
|
+
| `client.js` | 全部界面(React 无 JSX、样式 `<style>` 注入、只用宿主 token) |
|
|
119
|
+
|
|
120
|
+
## 开发
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
node --test test/*.test.mjs # 24 项:解析器 + 路由 + 导出 + 影印文件
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- Host 侧不依赖任何第三方包;PDF / EPUB / ZIP 都是自己解的。
|
|
127
|
+
- Client 侧只 `require('react')`,没有构建步骤。
|
|
128
|
+
- 改动后 ⌘R 刷新页面即可看到新界面。
|
|
129
|
+
|
|
130
|
+
## 已知边界
|
|
131
|
+
|
|
132
|
+
- 扫描版 PDF 可读但**不能划词**(浏览器内置 PDF 查看器里拿不到选区)。
|
|
133
|
+
- 加密 PDF 不处理。
|
|
134
|
+
- 微信读书付费章节按你账号的权限返回。
|
|
135
|
+
- 微信读书 Cookie 约一个月过期,过期后重新扫码即可。
|
|
136
|
+
|
|
137
|
+
## 致谢
|
|
138
|
+
|
|
139
|
+
微信读书网页版的签名与分片解码来自 [dsh-weread](https://github.com/wwjzzy/dsh-weread)(MIT),见 [NOTICE.md](NOTICE.md)。其余代码与界面为本项目原创。
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT © lysforge
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## English
|
|
148
|
+
|
|
149
|
+
**Lamplit** is a reading plugin for DeepSeek Harness: one shelf for WeChat Reading (微信读书), Fanqie Novel (番茄小说) and your own Markdown / TXT / EPUB / PDF files, with an immersive reader and AI-on-selection notes.
|
|
150
|
+
|
|
151
|
+
- **WeChat Reading** — scan the official QR once, then browse and read your own shelf inside Harness. Your cookie stays local.
|
|
152
|
+
- **Fanqie Novel** — paste a book link; the table of contents syncs. The free text is font-obfuscated by the platform, so Lamplit says so instead of showing garbage.
|
|
153
|
+
- **Your files** — Markdown, TXT, EPUB, PDF. Text PDFs are reflowed; scanned PDFs are rendered as pages (like Preview or Kindle), not force-extracted.
|
|
154
|
+
- **Selection AI** — select a passage, ask for an explanation or background, save it as a note; export notes as Markdown.
|
|
155
|
+
- **Local first** — everything lives in `~/.dsh/lamplit` with `0600`, no telemetry, no upload.
|
|
156
|
+
|
|
157
|
+
Install:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
dsh plugin --profile desktop add dsh-lamplit
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
MIT licensed. Built in the open at [lysforge/lamplit](https://github.com/lysforge/lamplit).
|