05f89ea1ac89534eb0466b58c9b488e85618cc90
Features: 1. scan command - Fast import without hash (skip_hash=true) - Scans directory structure - Generates deterministic UUIDs (SHA256(path|name|mac|mtime)) - Stores full path in aliases.json - Inserts nodes in batches - Performance: 14243 nodes/sec (11857 files in 0.89s) 2. hash command - Async hash calculation - Multi-threaded (default: 4 threads) - Reads paths from aliases.json - Updates database with SHA256 hashes - Performance: 28 files/sec (11857 files in 417.58s) Design: - Import first, hash later (user can view tree immediately) - Hash runs in background (non-blocking) - Path stored in aliases.json (temporary solution) - Deterministic UUIDs (same file = same UUID) Performance breakdown: - Scanning: 0.10s (11%) - ID generation: 0.57s (64%) - DB insertion: 0.21s (24%) - Hash: 417.58s (async, background) Files: - src/scan.rs (new, 499 lines) - src/main.rs (scan/hash commands) - src/lib.rs (scan module) Test result: - warren user: 12658 nodes imported - 11857 hashes calculated successfully
MarkBase
Momentry Display Engine - Markdown渲染與檔案樹管理系統
功能特色
- Markdown渲染(支援表格、footnote、tasklist) -檔案樹管理(SQLite持久化)
- REST API(18+路由)
- macOS音訊控制(音訊裝置切換、音量控制) -多種顯示模式(tree, list, grid_sm, grid_lg)
##安裝
###必要條件
- Rust 1.92+
- macOS(音訊功能需 macOS)
- SwitchAudioSource(音訊裝置切換)
#安裝 Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#安裝 SwitchAudioSource(macOS)
brew install switchaudio-source
###建構
cargo build
##使用
###啟動伺服器
cargo run -- display #預設 port 11438
cargo run -- display -p8080 #自訂 port
cargo run -- display README.md #顯示指定檔案
###渲染 Markdown
cargo run -- render README.md #輸出到 stdout
cargo run -- render README.md -o output.html
##測試
cargo test #執行所有測試
cargo test test_insert #執行特定測試
File Tree功能
REST API
| 路由 | 方法 | 功能 |
|---|---|---|
/api/v2/tree/:user_id |
GET | 取得檔案樹 |
/api/v2/tree/:user_id/node |
POST | 建立節點 |
/api/v2/tree/:user_id/node/:node_id |
PUT/DELETE | 更新/刪除節點 |
/api/v2/tree/:user_id/node/:node_id/move |
PUT | 移動節點 |
/api/v2/tree/:user_id/node/:node_id/alias |
PATCH | 更新別名 |
###顯示模式
tree- 樹狀顯示list- 列表顯示grid_sm- 小格狀顯示grid_lg- 大格狀顯示
###範例
curl http://localhost:11438/api/v2/tree/demo?mode=tree
curl http://localhost:11438/api/v2/tree/demo?mode=list
Demo資料
data/users/demo.sqlite- 50節點範例資料data/cache/-範例檔案
##開發
見 AGENTS.md詳細開發指南。
CI/CD
使用 Gitea Actions:https://gitea.momentry.ddns.net
License
MIT
Description
Languages
Rust
74.3%
HTML
14.4%
Shell
11.3%