diff --git a/README.md b/README.md index ff23fa9..80f884c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Moving Note -> 一个简洁的 Obsidian 同步插件:桌面端通过 Git 管理,移动端通过 GitHub API 同步。 +
+中文 | English -中文 | [English](README_en.md) +> 一个简洁的 Obsidian 同步插件:桌面端通过 Git 管理,移动端通过 GitHub API 同步。 Moving Note 是一款跨设备 Obsidian 笔记同步插件。桌面端利用系统 Git 实现自动 commit 和 push;安卓端通过 GitHub API 实现拉取和推送,无需本地 Git 环境。配置简单,一键同步,让你的笔记在多设备间保持一致。 @@ -17,8 +18,6 @@ Moving Note 是一款跨设备 Obsidian 笔记同步插件。桌面端利用系 ## 📦 安装 -### 从 GitHub 下载(推荐) - 1. 下载 `main.js`、`manifest.json`、`styles.css` 三个文件 2. 在 vault 的 `.obsidian/plugins/` 下创建 `moving-note` 文件夹 3. 将文件放入该文件夹 @@ -107,25 +106,130 @@ A: 桌面端会生成 `conflict-files-moving-note.md` 文件列出冲突文件 **Q: 可以用 GitLab / Gitea 等其他平台吗?** A: 桌面端支持任何 Git 远程仓库。安卓端目前仅支持 GitHub API。 -## 🛠️ 开发 +
+ +
+中文 | English + +> A simple Obsidian sync plugin: Git on desktop, GitHub API on mobile. Full read-write support on both platforms. + +Moving Note is a cross-device note sync plugin for Obsidian. On desktop, it leverages system Git for automatic commit and push. On Android, it uses the GitHub API for pulling and pushing changes — no local Git required. Simple to configure, one-click sync, keeping your notes consistent across devices. + +## ✨ Features + +- **Desktop**: Automatic commit & push to GitHub via system Git +- **Android**: Sync via GitHub API — pull remote changes and push local edits +- **One-click sync**: Pull → detect local changes → push, all in one step +- **Auto-sync**: Scheduled sync and sync-on-startup +- **Conflict handling**: Desktop generates conflict report files; mobile uses remote as source of truth +- **Flexible config**: Custom repo URL, branch name, commit message template + +## 📦 Installation + +1. Download `main.js`, `manifest.json`, and `styles.css` +2. Create a folder `moving-note` under `.obsidian/plugins/` in your vault +3. Place the files in that folder +4. Enable **Moving Note** in Obsidian Settings → Community Plugins + +## ⚙️ Configuration + +### Desktop + +1. Enter the **Repository URL** in settings (HTTPS or SSH) + ``` + https://github.com/user/repo + git@github.com:user/repo.git + ``` +2. Set the **Branch name** (default: `main`) +3. Ensure Git is installed and credentials are configured (SSH key or credential manager) + +### Android + +1. Enter the **Repository URL** in settings +2. Click "Open GitHub to Create Token" — permissions are pre-filled, just confirm +3. Paste the token and click "Verify & Login" +4. Set the **Branch name** (must match the branch used on desktop) + +## 🔄 Sync Logic + +### Desktop (full read/write) + +``` +Pull remote changes + ↓ +Commit local changes + ↓ +Push to remote +``` + +- Automatically ensures the current branch matches settings +- Stashes uncommitted changes before switching branches +- Skips pull if remote branch doesn't exist (e.g., first push) + +### Android (read + write via API) + +- **First sync**: Downloads all files from remote +- **Subsequent syncs**: Detects local changes → pulls remote updates → pushes local edits via GitHub Git Data API + +## 📋 Commands + +| Command | Description | +|---------|-------------| +| `Moving Note: Sync` | Full sync (pull → detect changes → push) | +| `Moving Note: Pull` | Pull remote updates only | +| `Moving Note: Commit & Push` | Commit and push local changes only | +| `Moving Note: Show Sync Status` | View current repo and sync info | + +There's also a sync button in the sidebar ribbon for quick access. + +## 📝 Commit Message Template + +Available placeholders: + +| Placeholder | Replaced with | +|-------------|---------------| +| `{{date}}` | Current time, format: `2026-06-13 12:00:00` | +| `{{hostname}}` | Repository owner name from settings | + +Default template: `vault backup: {{date}}` + +## ⚡ Auto-sync + +| Setting | Description | +|---------|-------------| +| Sync on startup | Automatically sync once when Obsidian starts | +| Auto-sync interval | Scheduled sync (minutes), set to 0 to disable | + +## ❓ FAQ + +**Q: Do I need to log in to GitHub?** +A: Optional on desktop, required on mobile. + +**Q: Can Android push changes?** +A: Yes. Android supports both pull and push via GitHub API. + +**Q: What about conflicts?** +A: On desktop, a `conflict-files-moving-note.md` file is generated listing conflicting files. Resolve them manually and sync again. + +**Q: Can I use GitLab / Gitea?** +A: Desktop supports any Git remote. Android currently only supports GitHub API. + +
+ +--- + +## 🛠️ Development ```bash -# 安装依赖 npm install - -# 开发模式(监听文件变化) npm run dev - -# 生产构建 npm run build ``` -构建产物在 `output/` 目录下。 +## 🙏 Acknowledgments -## 🙏 致谢 +- [obsidian-git](https://github.com/Vinzent03/obsidian-git) — The inspiration behind this plugin. -- [obsidian-git](https://github.com/Vinzent03/obsidian-git) — 本插件的灵感来源。obsidian-git 是 Obsidian 社区中最受欢迎的 Git 同步插件,本项目在开发过程中大量参考了它的架构设计和实现思路。 - -## 📄 许可证 +## 📄 License [MIT](LICENSE) diff --git a/README_en.md b/README_en.md deleted file mode 100644 index d73dd98..0000000 --- a/README_en.md +++ /dev/null @@ -1,131 +0,0 @@ -# Moving Note - -> A simple Obsidian sync plugin: Git on desktop, GitHub API on mobile. Full read-write support on both platforms. - -English | [中文](README.md) - -Moving Note is a cross-device note sync plugin for Obsidian. On desktop, it leverages system Git for automatic commit and push. On Android, it uses the GitHub API for pulling and pushing changes — no local Git required. Simple to configure, one-click sync, keeping your notes consistent across devices. - -## ✨ Features - -- **Desktop**: Automatic commit & push to GitHub via system Git -- **Android**: Sync via GitHub API — pull remote changes and push local edits -- **One-click sync**: Pull → detect local changes → push, all in one step -- **Auto-sync**: Scheduled sync and sync-on-startup -- **Conflict handling**: Desktop generates conflict report files; mobile uses remote as source of truth -- **Flexible config**: Custom repo URL, branch name, commit message template - -## 📦 Installation - -### Download from GitHub - -1. Download `main.js`, `manifest.json`, and `styles.css` -2. Create a folder `moving-note` under `.obsidian/plugins/` in your vault -3. Place the files in that folder -4. Enable **Moving Note** in Obsidian Settings → Community Plugins - -## ⚙️ Configuration - -### Desktop - -1. Enter the **Repository URL** in settings (HTTPS or SSH) - ``` - https://github.com/user/repo - git@github.com:user/repo.git - ``` -2. Set the **Branch name** (default: `main`) -3. Ensure Git is installed and credentials are configured (SSH key or credential manager) - -### Android - -1. Enter the **Repository URL** in settings -2. Click "Open GitHub to Create Token" — permissions are pre-filled, just confirm -3. Paste the token and click "Verify & Login" -4. Set the **Branch name** (must match the branch used on desktop) - -## 🔄 Sync Logic - -### Desktop (full read/write) - -``` -Pull remote changes - ↓ -Commit local changes - ↓ -Push to remote -``` - -- Automatically ensures the current branch matches settings -- Stashes uncommitted changes before switching branches -- Skips pull if remote branch doesn't exist (e.g., first push) - -### Android (read + write via API) - -- **First sync**: Downloads all files from remote -- **Subsequent syncs**: Detects local changes → pulls remote updates → pushes local edits via GitHub Git Data API - -## 📋 Commands - -| Command | Description | -|---------|-------------| -| `Moving Note: Sync` | Full sync (pull → detect changes → push) | -| `Moving Note: Pull` | Pull remote updates only | -| `Moving Note: Commit & Push` | Commit and push local changes only | -| `Moving Note: Show Sync Status` | View current repo and sync info | - -There's also a sync button in the sidebar ribbon for quick access. - -## 📝 Commit Message Template - -Available placeholders: - -| Placeholder | Replaced with | -|-------------|---------------| -| `{{date}}` | Current time, format: `2026-06-13 12:00:00` | -| `{{hostname}}` | Repository owner name from settings | - -Default template: `vault backup: {{date}}` - -## ⚡ Auto-sync - -| Setting | Description | -|---------|-------------| -| Sync on startup | Automatically sync once when Obsidian starts | -| Auto-sync interval | Scheduled sync (minutes), set to 0 to disable | - -## ❓ FAQ - -**Q: Do I need to log in to GitHub?** -A: Optional on desktop, required on mobile. - -**Q: Can Android push changes?** -A: Yes. Android supports both pull and push via GitHub API. - -**Q: What about conflicts?** -A: On desktop, a `conflict-files-moving-note.md` file is generated listing conflicting files. Resolve them manually and sync again. - -**Q: Can I use GitLab / Gitea?** -A: Desktop supports any Git remote. Android currently only supports GitHub API. - -## 🛠️ Development - -```bash -# Install dependencies -npm install - -# Development mode (watch for changes) -npm run dev - -# Production build -npm run build -``` - -Build output is in the `output/` directory. - -## 🙏 Acknowledgments - -- [obsidian-git](https://github.com/Vinzent03/obsidian-git) — The inspiration behind this plugin. obsidian-git is the most popular Git sync plugin in the Obsidian community, and this project draws heavily from its architecture and implementation. - -## 📄 License - -[MIT](LICENSE)