feat: integrate CoreDoc documentation routes into web server
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

- Add 'fs' feature to tower-http for ServeDir support
- Integrate docs_routes() into main router
- Support three documentation endpoints:
  * /docs/legacy - Legacy WASM documentation system
  * /docs/api - API documentation
  * /docs/cli - CLI documentation
- Add generic type parameter to docs_routes for AppState compatibility
- Add INSTALLATION.md with auto-installation instructions

Tested successfully:
- Service running on port 11438
- All documentation endpoints accessible
- API health check passing
This commit is contained in:
Warren
2026-10-25 23:25:22 +08:00
parent c28acd0512
commit 8073ed0752
4 changed files with 226 additions and 7 deletions
+1 -3
View File
@@ -18,7 +18,6 @@ sevenz-rust = { version = "0.6.1", optional = true } # 7z格式 ⚠️库不
anyhow = "1"
axum = { version = "0.7", features = ["macros"] }
bcrypt = "0.16"
sysinfo = "0.32"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
lazy_static = "1.5"
@@ -73,10 +72,9 @@ rusty-s3 = "0.10" # S3 API 签名(AWS Signature V4)
ureq = "2.12" # 輕量同步 HTTP 客戶端
reqwest = { version = "0.12", optional = true } # Async HTTP client for AsyncS3Vfs
rayon = "1.10" # Phase 4: 并行加密
tower-http = { version = "0.5", features = ["cors"] }
tower-http = { version = "0.5", features = ["cors", "fs"] }
url = "2" # URL 解析(rusty-s3 依賴)
xattr = "1.0" # Extended attributes support (AFP_AfpInfo, Time Machine)
dirs = "5.0" # User home directory detection
# === SMB/CIFS Client (Phase 1) ===
smb2 = { path = "../vendor/smb2" } # Pure-Rust SMB2/3 client library with pipelined I/O
+7 -4
View File
@@ -1,14 +1,17 @@
use axum::Router;
use tower_http::services::ServeDir;
pub fn docs_routes() -> Router {
pub fn docs_routes<S>() -> Router<S>
where
S: Clone + Send + Sync + 'static,
{
Router::new()
// Legacy WASM documentation system
.nest_service("/legacy", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/doc_wasm"))
.nest_service("/docs/legacy", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/doc_wasm"))
// New API documentation
.nest_service("/api", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE"))
.nest_service("/docs/api", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE"))
// New CLI documentation
.nest_service("/cli", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE"))
.nest_service("/docs/cli", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE"))
}
+3
View File
@@ -26,6 +26,7 @@ use crate::audio;
use crate::auth::{AuthState, LoginRequest};
use crate::provider::sqlite::SqliteProvider;
use crate::render;
use crate::api::docs::docs_routes;
use filetree::{self, FileTree};
use tower_http::cors::CorsLayer;
@@ -279,6 +280,8 @@ pub async fn run(port: u16, file: Option<String>, home: PathBuf) -> anyhow::Resu
.route("/body", get(body_handler))
.route("/status", get(status_handler))
.route("/labels", get(get_labels).post(post_labels))
// CoreDoc documentation system
.merge(docs_routes())
// Auth endpoints (public)
.route("/api/v2/auth/login", post(login_handler))
.route("/api/v2/auth/logout", post(logout_handler))