feat: add app feature flags and gate static routes
This commit is contained in:
parent
1435d1016f
commit
55947a20b9
2 changed files with 121 additions and 39 deletions
36
Cargo.toml
36
Cargo.toml
|
|
@ -13,9 +13,43 @@ path = "../botlib"
|
||||||
features = ["http-client"]
|
features = ["http-client"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["ui-server"]
|
default = ["ui-server", "chat", "drive", "tasks"]
|
||||||
ui-server = []
|
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]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
|
|
|
||||||
|
|
@ -25,43 +25,94 @@ const SUITE_DIRS: &[&str] = &[
|
||||||
"js",
|
"js",
|
||||||
"css",
|
"css",
|
||||||
"public",
|
"public",
|
||||||
"drive",
|
|
||||||
"chat",
|
|
||||||
"mail",
|
|
||||||
"tasks",
|
|
||||||
"calendar",
|
|
||||||
"meet",
|
|
||||||
"paper",
|
|
||||||
"sheet",
|
|
||||||
"slides",
|
|
||||||
"docs",
|
|
||||||
"research",
|
|
||||||
"analytics",
|
|
||||||
"monitoring",
|
|
||||||
"admin",
|
|
||||||
"auth",
|
|
||||||
"settings",
|
|
||||||
"sources",
|
|
||||||
"attendant",
|
|
||||||
"tools",
|
|
||||||
"assets",
|
"assets",
|
||||||
"partials",
|
"partials",
|
||||||
"video",
|
// Core & Support
|
||||||
"learn",
|
"settings",
|
||||||
"social",
|
"auth",
|
||||||
"dashboards",
|
|
||||||
"designer",
|
|
||||||
"workspace",
|
|
||||||
"project",
|
|
||||||
"goals",
|
|
||||||
"player",
|
|
||||||
"canvas",
|
|
||||||
"people",
|
|
||||||
"crm",
|
|
||||||
"billing",
|
|
||||||
"products",
|
|
||||||
"tickets",
|
|
||||||
"about",
|
"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 {
|
pub async fn index() -> impl IntoResponse {
|
||||||
|
|
@ -604,9 +655,6 @@ pub fn configure_router() -> Router {
|
||||||
router = add_static_routes(router, &suite_path);
|
router = add_static_routes(router, &suite_path);
|
||||||
|
|
||||||
router
|
router
|
||||||
.fallback_service(
|
.fallback(get(index))
|
||||||
ServeDir::new(suite_path.clone())
|
|
||||||
.fallback(ServeDir::new(suite_path).append_index_html_on_directories(true)),
|
|
||||||
)
|
|
||||||
.with_state(state)
|
.with_state(state)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue