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"]
|
minimal = ["chat"]
|
||||||
lightweight = ["chat", "tasks", "people"]
|
lightweight = ["chat", "tasks", "people"]
|
||||||
full = ["chat", "people", "mail", "tasks", "calendar", "drive", "docs", "llm", "cache", "compliance"]
|
full = ["chat", "people", "mail", "tasks", "calendar", "drive", "docs", "llm", "cache", "compliance"]
|
||||||
|
embed-ui = ["dep:rust-embed"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
diesel_migrations = { workspace = true }
|
diesel_migrations = { workspace = true }
|
||||||
|
|
@ -215,7 +216,7 @@ scraper = { workspace = true }
|
||||||
walkdir = { workspace = true }
|
walkdir = { workspace = true }
|
||||||
|
|
||||||
# Embedded static files
|
# Embedded static files
|
||||||
rust-embed = { workspace = true }
|
rust-embed = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mockito = { workspace = true }
|
mockito = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ pub async fn workflow_designer_page(
|
||||||
content = '<strong>Parallel</strong><br>Multiple branches';
|
content = '<strong>Parallel</strong><br>Multiple branches';
|
||||||
break;
|
break;
|
||||||
case 'event':
|
case 'event':
|
||||||
content = '<strong>Event</strong><br><input type="text" placeholder="Event Name" style="width:100px;margin:2px;">';
|
content = '<strong>Event</strong><br><input type="text" placeholder="Event Name " style="width:100px;margin:2px;">';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -873,4 +873,3 @@ pub async fn save_auto_responder(
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
use axum::{
|
use axum::{
|
||||||
body::Body,
|
body::Body,
|
||||||
http::{header, Request, Response, StatusCode},
|
http::{header, Request, Response, StatusCode},
|
||||||
Router,
|
Router,
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
use rust_embed::RustEmbed;
|
use rust_embed::RustEmbed;
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
#[derive(RustEmbed)]
|
#[derive(RustEmbed)]
|
||||||
#[folder = "../botui/ui/suite/"]
|
#[folder = "../botui/ui/suite/"]
|
||||||
#[prefix = ""]
|
#[prefix = ""]
|
||||||
struct EmbeddedUi;
|
struct EmbeddedUi;
|
||||||
|
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
fn get_mime_type(path: &str) -> &'static str {
|
fn get_mime_type(path: &str) -> &'static str {
|
||||||
let ext = Path::new(path)
|
let ext = Path::new(path)
|
||||||
.extension()
|
.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> {
|
async fn serve_embedded_file(req: Request<Body>) -> Response<Body> {
|
||||||
let path = req.uri().path().trim_start_matches('/');
|
let path = req.uri().path().trim_start_matches('/');
|
||||||
|
|
||||||
|
|
@ -105,11 +111,13 @@ async fn serve_embedded_file(req: Request<Body>) -> Response<Body> {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
pub fn embedded_ui_router() -> Router {
|
pub fn embedded_ui_router() -> Router {
|
||||||
use axum::routing::any;
|
use axum::routing::any;
|
||||||
Router::new().fallback(any(serve_embedded_file))
|
Router::new().fallback(any(serve_embedded_file))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
pub fn has_embedded_ui() -> bool {
|
pub fn has_embedded_ui() -> bool {
|
||||||
let has_index = EmbeddedUi::get("index.html").is_some();
|
let has_index = EmbeddedUi::get("index.html").is_some();
|
||||||
if has_index {
|
if has_index {
|
||||||
|
|
@ -120,6 +128,7 @@ pub fn has_embedded_ui() -> bool {
|
||||||
has_index
|
has_index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "embed-ui")]
|
||||||
pub fn list_embedded_files() -> Vec<String> {
|
pub fn list_embedded_files() -> Vec<String> {
|
||||||
let files: Vec<String> = EmbeddedUi::iter().map(|f| f.to_string()).collect();
|
let files: Vec<String> = EmbeddedUi::iter().map(|f| f.to_string()).collect();
|
||||||
log::debug!("Embedded UI contains {} files", files.len());
|
log::debug!("Embedded UI contains {} files", files.len());
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ pub mod research;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
pub mod security;
|
pub mod security;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
#[cfg(feature = "dashboards")]
|
|
||||||
pub mod shared;
|
pub mod shared;
|
||||||
#[cfg(feature = "sheet")]
|
#[cfg(feature = "sheet")]
|
||||||
pub mod sheet;
|
pub mod sheet;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue