Fix UI directory detection: skip filesystem checks when embed-ui is enabled

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-02-05 09:44:20 -03:00
parent 77374ae638
commit abdd2ff615

View file

@ -224,6 +224,13 @@ pub async fn index(OriginalUri(uri): OriginalUri) -> Response {
} }
pub fn get_ui_root() -> PathBuf { pub fn get_ui_root() -> PathBuf {
#[cfg(feature = "embed-ui")]
{
PathBuf::from("ui")
}
#[cfg(not(feature = "embed-ui"))]
{
let candidates = [ let candidates = [
"ui", "ui",
"botui/ui", "botui/ui",
@ -240,7 +247,6 @@ pub fn get_ui_root() -> PathBuf {
} }
} }
// Fallback to "ui" but log a warning
let default = PathBuf::from("ui"); let default = PathBuf::from("ui");
error!( error!(
"Could not find 'ui' directory in candidates: {:?}. Defaulting to 'ui' (CWD: {:?})", "Could not find 'ui' directory in candidates: {:?}. Defaulting to 'ui' (CWD: {:?})",
@ -249,6 +255,7 @@ pub fn get_ui_root() -> PathBuf {
); );
default default
} }
}
pub async fn serve_minimal() -> impl IntoResponse { pub async fn serve_minimal() -> impl IntoResponse {
let html_res = { let html_res = {