Fix compilation errors for CI: Make embed-ui optional, fix HTML strings, shared module, email syntax
This commit is contained in:
parent
e4b785d7b1
commit
8d405e6926
5 changed files with 12 additions and 4 deletions
|
|
@ -87,6 +87,7 @@ console = ["automation", "drive", "cache", "dep:crossterm", "dep:ratatui"]
|
|||
minimal = ["chat"]
|
||||
lightweight = ["chat", "tasks", "people"]
|
||||
full = ["chat", "people", "mail", "tasks", "calendar", "drive", "docs", "llm", "cache", "compliance"]
|
||||
embed-ui = ["dep:rust-embed"]
|
||||
|
||||
[dependencies]
|
||||
diesel_migrations = { workspace = true }
|
||||
|
|
@ -215,7 +216,7 @@ scraper = { workspace = true }
|
|||
walkdir = { workspace = true }
|
||||
|
||||
# Embedded static files
|
||||
rust-embed = { workspace = true }
|
||||
rust-embed = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
mockito = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -873,4 +873,3 @@ pub async fn save_auto_responder(
|
|||
.to_string(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,21 @@
|
|||
#[cfg(feature = "embed-ui")]
|
||||
use axum::{
|
||||
body::Body,
|
||||
http::{header, Request, Response, StatusCode},
|
||||
Router,
|
||||
};
|
||||
#[cfg(feature = "embed-ui")]
|
||||
use rust_embed::RustEmbed;
|
||||
#[cfg(feature = "embed-ui")]
|
||||
use std::path::Path;
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "../botui/ui/suite/"]
|
||||
#[prefix = ""]
|
||||
struct EmbeddedUi;
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
fn get_mime_type(path: &str) -> &'static str {
|
||||
let ext = Path::new(path)
|
||||
.extension()
|
||||
|
|
@ -47,6 +52,7 @@ fn get_mime_type(path: &str) -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
async fn serve_embedded_file(req: Request<Body>) -> Response<Body> {
|
||||
let path = req.uri().path().trim_start_matches('/');
|
||||
|
||||
|
|
@ -105,11 +111,13 @@ async fn serve_embedded_file(req: Request<Body>) -> Response<Body> {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
pub fn embedded_ui_router() -> Router {
|
||||
use axum::routing::any;
|
||||
Router::new().fallback(any(serve_embedded_file))
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
pub fn has_embedded_ui() -> bool {
|
||||
let has_index = EmbeddedUi::get("index.html").is_some();
|
||||
if has_index {
|
||||
|
|
@ -120,6 +128,7 @@ pub fn has_embedded_ui() -> bool {
|
|||
has_index
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed-ui")]
|
||||
pub fn list_embedded_files() -> Vec<String> {
|
||||
let files: Vec<String> = EmbeddedUi::iter().map(|f| f.to_string()).collect();
|
||||
log::debug!("Embedded UI contains {} files", files.len());
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ pub mod research;
|
|||
pub mod search;
|
||||
pub mod security;
|
||||
pub mod settings;
|
||||
#[cfg(feature = "dashboards")]
|
||||
pub mod shared;
|
||||
#[cfg(feature = "sheet")]
|
||||
pub mod sheet;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue