diff --git a/apps/nxmesh-master/src/routes/frontend/mod.rs b/apps/nxmesh-master/src/routes/frontend/mod.rs index db345f6..4b49fe5 100644 --- a/apps/nxmesh-master/src/routes/frontend/mod.rs +++ b/apps/nxmesh-master/src/routes/frontend/mod.rs @@ -37,7 +37,11 @@ pub async fn get_fallback_handler() -> Result>, axu } fn get_index_html() -> Option> { - FrontendAssets::get(INDEX_HTML).map(|asset| asset.data.as_ref().to_owned()) + // Try root index.html first, then fall back to client/index.html when assets + // are packaged under the `client/` subfolder. + FrontendAssets::get(INDEX_HTML) + .or_else(|| FrontendAssets::get(&format!("client/{}", INDEX_HTML))) + .map(|asset| asset.data.as_ref().to_owned()) } async fn get_file_handler( @@ -49,7 +53,10 @@ async fn get_file_handler( path }; - match FrontendAssets::get(&file_path) { + // Try direct lookup first, then fallback to the `client/` subfolder. + match FrontendAssets::get(&file_path) + .or_else(|| FrontendAssets::get(&format!("client/{}", file_path))) + { Some(asset) => { let content_type = mime_guess::from_path(&file_path).first_or_octet_stream(); let response = axum::response::Response::builder()