From 55947a20b9f51aff44f77feb50ef6c5ef0348437 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Thu, 22 Jan 2026 21:23:41 -0300 Subject: [PATCH] feat: add app feature flags and gate static routes --- Cargo.toml | 36 ++++++++++++- src/ui_server/mod.rs | 124 ++++++++++++++++++++++++++++++------------- 2 files changed, 121 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 21e71f5..2977695 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,43 @@ path = "../botlib" features = ["http-client"] [features] -default = ["ui-server"] +default = ["ui-server", "chat", "drive", "tasks"] ui-server = [] +# App Features +chat = [] +mail = [] +calendar = [] +drive = [] +tasks = [] +docs = [] +paper = [] +sheet = [] +slides = [] +meet = [] +research = [] +analytics = [] +monitoring = [] +admin = [] +settings = [] +sources = [] +attendant = [] +tools = [] +video = [] +learn = [] +social = [] +dashboards = [] +designer = [] +workspace = [] +project = [] +goals = [] +player = [] +canvas = [] +people = [] +billing = [] +products = [] +tickets = [] + [dependencies] anyhow = "1.0" async-trait = "0.1" diff --git a/src/ui_server/mod.rs b/src/ui_server/mod.rs index e2148da..4b36251 100644 --- a/src/ui_server/mod.rs +++ b/src/ui_server/mod.rs @@ -25,43 +25,94 @@ const SUITE_DIRS: &[&str] = &[ "js", "css", "public", - "drive", - "chat", - "mail", - "tasks", - "calendar", - "meet", - "paper", - "sheet", - "slides", - "docs", - "research", - "analytics", - "monitoring", - "admin", - "auth", - "settings", - "sources", - "attendant", - "tools", "assets", "partials", - "video", - "learn", - "social", - "dashboards", - "designer", - "workspace", - "project", - "goals", - "player", - "canvas", - "people", - "crm", - "billing", - "products", - "tickets", + // Core & Support + "settings", + "auth", "about", + + // Core Apps + #[cfg(feature = "drive")] + "drive", + #[cfg(feature = "chat")] + "chat", + #[cfg(feature = "mail")] + "mail", + #[cfg(feature = "tasks")] + "tasks", + #[cfg(feature = "calendar")] + "calendar", + #[cfg(feature = "meet")] + "meet", + + // Document Apps + #[cfg(feature = "paper")] + "paper", + #[cfg(feature = "sheet")] + "sheet", + #[cfg(feature = "slides")] + "slides", + #[cfg(feature = "docs")] + "docs", + + // Research & Learning + #[cfg(feature = "research")] + "research", + #[cfg(feature = "sources")] + "sources", + #[cfg(feature = "learn")] + "learn", + + // Analytics + #[cfg(feature = "analytics")] + "analytics", + #[cfg(feature = "dashboards")] + "dashboards", + #[cfg(feature = "monitoring")] + "monitoring", + + // Admin & Tools + #[cfg(feature = "admin")] + "admin", + #[cfg(feature = "attendant")] + "attendant", + #[cfg(feature = "tools")] + "tools", + + // Media + #[cfg(feature = "video")] + "video", + #[cfg(feature = "player")] + "player", + #[cfg(feature = "canvas")] + "canvas", + + // Social + #[cfg(feature = "social")] + "social", + #[cfg(feature = "people")] + "people", + #[cfg(feature = "people")] + "crm", + #[cfg(feature = "tickets")] + "tickets", + + // Business + #[cfg(feature = "billing")] + "billing", + #[cfg(feature = "products")] + "products", + + // Development + #[cfg(feature = "designer")] + "designer", + #[cfg(feature = "workspace")] + "workspace", + #[cfg(feature = "project")] + "project", + #[cfg(feature = "goals")] + "goals", ]; pub async fn index() -> impl IntoResponse { @@ -604,9 +655,6 @@ pub fn configure_router() -> Router { router = add_static_routes(router, &suite_path); router - .fallback_service( - ServeDir::new(suite_path.clone()) - .fallback(ServeDir::new(suite_path).append_index_html_on_directories(true)), - ) + .fallback(get(index)) .with_state(state) }