mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Better Static Asset serving and fix extra header
This commit is contained in:
parent
5f4b7c3f02
commit
40b6625620
@ -69,16 +69,18 @@ async fn ui_static_assets(Path(path): Path<String>) -> impl IntoResponse {
|
||||
info!("Serving ui path");
|
||||
|
||||
let mut path = path.trim_start_matches("/");
|
||||
path = match path {
|
||||
"" | "inventory" | "plan" | "cook" | "categories" | "login" => "index.html",
|
||||
_ => {
|
||||
if path.starts_with("recipe") {
|
||||
"index.html"
|
||||
} else {
|
||||
path
|
||||
if UiAssets::get(path).is_none() {
|
||||
path = match path {
|
||||
"" | "inventory" | "plan" | "cook" | "categories" | "login" => "index.html",
|
||||
_ => {
|
||||
if path.starts_with("recipe") {
|
||||
"index.html"
|
||||
} else {
|
||||
path
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
debug!(path = path, "Serving transformed path");
|
||||
StaticFile(path.to_owned())
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ pub fn UI<G: Html>(cx: Scope) -> View<G> {
|
||||
};
|
||||
view.set(view! { cx,
|
||||
div(class="app") {
|
||||
Header()
|
||||
Router(RouterProps {
|
||||
route: Routes::Plan,
|
||||
route_select: route_switch,
|
||||
|
Loading…
x
Reference in New Issue
Block a user