MoonReader Note Sync

by seeyou2night
5
4
3
2
1
Score: 31/100

Description

Reviews

No reviews yet.

Stats

3
stars
116
downloads
0
forks
93
days
4
days
4
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
1
total issues
1
open issues
0
closed issues
23
commits

Latest Version

4 days ago

Changelog

更新记录

0.3.2

  • 缓存改用 Obsidian 的库内文件接口,保留原缓存格式、账号隔离和写入失败时的旧缓存。
  • 设置接入声明式 API,连接字段、显示数量、导入方式和默认模板支持全局设置搜索。连接仍须验证后才保存,密码继续保存在 Keychain。
  • 最低 Obsidian 版本提高到 1.13.0。
  • README 首页使用完整英文说明,中文说明移至 README.zh-CN.md。

0.3.1

  • 恢复社区目录已登记的插件 ID obsidian-moonreader-sync,避免更新时被识别为不同插件。
  • 设置标题使用 Obsidian 原生组件,语言检测仅使用宿主 API;校验加载的配置类型,移除额外的 builtin-modules 依赖和 CSS :has 选择器。
  • 发布仅附带三个插件文件,并为它们生成 GitHub 构建来源证明。
  • 首页补充英文安装和使用说明,更新手动安装目录及发布说明。

0.3.0

  • 增加书籍显示数量设置,0 表示全部;搜索覆盖全部缓存书籍,显示限制不影响下载。
  • 在书籍列表上方增加原生排序菜单,支持备份修改时间和书名的升降序,自动保存选择并保留当前选书;无有效日期的书籍始终排在最后。
  • 精简连接提示、书籍列表和底部目标信息,完整路径保留在悬停提示与替换确认中。
  • 补充英文 README,并在两种语言的说明中明确日期来源与显示数量的作用。

0.2.0

  • 将选书、预览和导入放在同一面板,支持搜索、键盘操作和窄窗口布局。
  • 增加测试连接按钮。刷新与设置各自执行对应操作,连接状态区分未配置、尚未保存和已保存。
  • 密码改用 Obsidian 原生密钥库,最低版本调整为桌面版 1.11.5。旧版升级后需重新填写密码,不再使用独立 key 文件。
  • 模板编辑显示可用字段,支持点击插入和保存默认模板。
  • 优先使用仍打开的最近笔记作为导入目标;替换正文与同一会话内重复导入均需要确认。
  • 修复损坏记录、异常 WebDAV 响应和重复文件响应的处理,刷新失败时保留已有缓存。
  • 作者显示更新为 seeyou2night,整理使用说明、测试目录和发布检查。

导入不会跨会话去重,也不会修改远端备份。真实远端服务、Obsidian 1.11.5 和其他操作系统尚未完成验证。

README file from

Github

MoonReader Note Sync

English | 中文

Import highlights and annotations from Moon+ Reader WebDAV backups into Obsidian. Search books, preview notes, and customize the import template. The interface follows Obsidian's language setting in English or Chinese, and cached books are available offline.

Requires Obsidian 1.13.0 or later on desktop. Mobile is not supported. The current version is 0.3.2; see CHANGELOG for changes.

Installation

Download main.js, manifest.json, and styles.css from GitHub Releases. Place them directly in your vault's .obsidian/plugins/obsidian-moonreader-sync/ folder, then enable the plugin in Obsidian's community plugin settings.

GitHub's automatically generated source archives do not contain the built plugin. If you installed it under another folder name, preserve data.json and the cache files when updating to the folder above, and avoid duplicate installations.

Usage

Connect your backup

First, back up your reading annotations to WebDAV from Moon+ Reader. Check that the backup folder contains .an files.

  1. Open the plugin settings and enter the WebDAV folder URL, username, and password or app password.
  2. Optionally select Test connection to check folder access. Testing does not save settings.
  3. Select Save connection. After validation, the password is stored in Obsidian Keychain.
  4. Open the library from the ribbon button or the Browse and import notes command. Books are fetched automatically if there is no cache. Use the refresh button for later updates.

If setup is incomplete, refreshing shows an explanation. The library's settings button opens the connection form; import preferences and the default template are available in the full plugin settings.

Upgrading from an older version

Version 0.2.0 no longer uses a separate key file or migrates old passwords. Re-enter your password once and save the connection. The server URL, username, template, and cache can be retained. Old key files are not deleted automatically.

Import notes

Search or select a book on the left. The right pane previews the first three annotations, and the footer shows the destination and insertion mode. Insert N notes imports all annotations from the selected book.

  • By default, notes are inserted at the cursor position captured when the panel opened. Selected text is not replaced. If another pane has focus, the plugin uses the most recent Markdown note that is still open.
  • If no destination note is open, select Choose note, choose a file, then select Append N notes.
  • More lets you append, change the destination, or replace the body. Replacement requires confirmation and preserves the file's leading YAML properties.
  • Adjust template shows available fields. Click or drag a field into the template. Changes apply to this import unless you select Save as default template.
  • Importing the same book into the same note again during one plugin session requires Import again confirmation. Canceling or closing before writing does not write anything; closing during a write waits for it to finish.

Use the arrow keys in the search field to select a book. Enter focuses the import button. Ctrl/Cmd+Enter inserts or appends; it cannot bypass replacement or repeated-import confirmation.

There is no deduplication across sessions or two-way synchronization. Repeated imports may create duplicate content and block IDs. Importing does not delete or modify remote backups.

Library display settings

The row above the book list shows the count and current order, such as Modified ↓. Click the order button to choose modification time or title, and ascending or descending order, from an Obsidian native menu. Changes apply immediately and are saved for the next time you open the library. Books shown remains in the full plugin settings. The defaults show all books, ordered by backup modification time, newest first.

  • Enter a non-negative integer for the display limit. 0 shows all books. This changes only the list, not refreshes, downloads, or the cache. The list shows the visible count and the total number of matches.
  • Search matches all cached books before sorting and applying the limit, so books beyond the limit can still be found by searching.
  • Date means the WebDAV backup file's modification time, not reading time, annotation time, or download time. Books with missing or invalid dates appear last. Equal dates are ordered by title.
  • Switching to title defaults to ascending order, ignores case, and compares embedded numbers numerically: Book 2 precedes Book 10. Letter order follows the system locale. Switching to modification time defaults to descending order. Both directions are available for either field.
  • Sorting preserves the search and selected book. If the display limit hides that book, the first visible book is selected and its preview appears. Connection hints are hidden once configured. The footer shows the destination filename, with the full path on hover; replacement confirmation still shows the full path.

These features are available from 0.3.0. Handling of missing books has not changed.

Checks for these additions passed on Node 22 and 24: 50 tests passed and the private-sample test was skipped. Coverage includes limits, both sort directions, selection retention, search across all books, unrestricted downloads, failed saves, and defaults for old configurations. Manual checks in Windows Obsidian 1.13.7 covered the native menu, order changes, selection retention, and the simplified layout. Remote refreshes and note writes were not repeated in this round.

Template fields

Field Value
{bookName} Book title
{chapter} Chapter index
{highlightText} Highlighted text
{note} Personal annotation
{color} RGB hexadecimal color
{timestamp} UTC time text
{id} Original annotation ID

Templates support Markdown and HTML. Field values are HTML-escaped. Preview and import use the same substitution logic.

Data and network access

The plugin connects to the WebDAV service you configure, using that service's account to read the backup directory and .an files. It has no telemetry, advertisements, or additional network services.

Obsidian Keychain manages passwords locally; the plugin configuration stores only a credential name. Configure the password again on another device. Leave the password field blank to keep an existing password; changing the account or server requires re-entering it. Password updates do not overwrite old credentials. Unused entries can be managed in Obsidian Keychain.

Book caches are stored as plain text in the plugin folder, separately for each server directory and account. The plugin does not require access to files outside the vault.

The cache uses the Obsidian vault adapter for temporary writes and replacement inside the plugin folder; it does not access the system filesystem directly. The destination picker lists Markdown file paths through Obsidian's vault API without reading all note contents. The plugin does not store data in localStorage or sessionStorage.

Settings use the Obsidian declarative API. Connection fields, display limits, import mode, and the default template appear in global settings search. Connection drafts are saved only after validation.

Troubleshooting

  • No books found: Point the URL directly to the WebDAV folder containing .an files. If the connection succeeds but finds no annotation files, check Moon+ Reader's backup location.
  • Authentication or access denied: Check the username, app password, and folder read permissions. Re-enter and save the password if the stored credential is unavailable.
  • A book fails to update: Its previous cache is retained and marked as failed. Refresh again to retry. If the entire directory cannot be read, all cached books are retained.
  • A book was removed remotely: After a successful refresh it disappears from the cached list. Imported Markdown files are unchanged.
  • The original note changed: If the note changes after opening the panel, insertion at the old cursor is refused. You can switch to appending instead.
  • Unsupported backup format: The parser currently supports the verified fixed 17-line record format. Corrupt or incomplete records cause an error, preventing partial data from overwriting a complete cache.

Development and validation

Use Node.js 22:

npm ci
npm run check
npm run dev

npm run check runs type checking, automated tests, a production build, and release file checks. Tests cover parser/cache regressions and HTTP/UI integration. UI tests use jsdom and explicit Obsidian substitutes; they do not replace testing in the actual app. Private .an samples can be placed in the ignored .testdata/ folder. That test is skipped when no samples are present.

For manual testing in Obsidian, run node tests/fixtures/webdav-server.mjs. It listens only on 127.0.0.1:60923, serves /dav/, and uses the synthetic username native-qa and password synthetic-native-password. Its data is checked by the actual parser before startup. Use a separate test note to check connection testing, saving, refreshing, and import modes. Restore your connection and stop the service afterward.

For 0.3.2, checks passed on Node 22 and 24: 53 tests passed and the private-sample test was skipped. In Windows Obsidian 1.13.7, manual checks confirmed global settings search, connection testing without saving drafts, connection saving, initial cache writes, and replacement of existing cache files using a local synthetic backup. Original connection and cache files were restored and their hashes checked afterward. Note imports and real remote services were not retested in this round.

For 0.2.0, checks passed on Node 22, Node 24, and an independent installation: 44 tests passed and the private-sample test was skipped. Build hashes matched, tag and ZIP checks passed, and the dependency audit reported no known vulnerabilities. GitHub build and release workflows also passed.

Earlier manual checks in Windows Obsidian 1.13.7 covered connection testing, native password storage and retrieval, refreshes, cursor insertion, appending, replacement, repeated-import confirmation, template fields, and long titles using synthetic accounts and a local server. An earlier private-sample check compared 44 records. Real remote WebDAV services, Obsidian 1.13.0, other operating systems, and password retrieval after a full app restart remain untested.

The development obsidian package pins an older moment dependency; this project overrides it with the patched 2.31.0 version. It is used only for development type checking, is excluded from the release bundle, and does not replace Obsidian's own dependencies.

skipLibCheck skips checks inside dependency declarations because the Obsidian 1.13.1 SDK declarations omit onHistoryBack from three classes implementing HistoryHandler. Strict checking remains enabled for project code.

Release process

  1. Update manifest.json, package.json, package-lock.json, and versions.json together. Describe the changes in CHANGELOG.md.
  2. Run npm ci, npm run check, and npm run check:release -- 0.3.2 with the intended version to check metadata, compatibility, licenses, and build files.
  3. Commit the source and release configuration, then push a tag matching the version exactly, such as 0.3.2, without a v prefix.
  4. The release workflow checks the build, generates provenance attestations for main.js, manifest.json, and styles.css, and uploads only these three plugin files. The project license remains in the repository; third-party notices are included in main.js.

For a first community-directory submission, follow the official Obsidian instructions. A published GitHub release and acceptance into the community directory are separate steps.

License

The project uses the ISC license, retaining the existing copyright notice. The release bundles decompression code from pako, licensed under MIT and Zlib. Full notices are in THIRD-PARTY-NOTICES.txt and are also included in main.js.