fix static handler
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m51s

This commit is contained in:
Alex Janka 2024-01-23 12:41:30 +11:00
parent 5dd599d93b
commit dc234260c7
3 changed files with 13 additions and 6 deletions

2
Cargo.lock generated
View file

@ -2633,7 +2633,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.22"
version = "1.0.23"
dependencies = [
"chrono",
"clap 4.4.11",

View file

@ -1,6 +1,6 @@
[package]
name = "tesla-charge-controller"
version = "1.0.22"
version = "1.0.23"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"

View file

@ -45,10 +45,17 @@ impl Handler for UiStatic {
index.respond_to(req).or_forward((data, Status::NotFound))
} else {
let file = UI_DIR_FILES.get_file(&p).map(|v| RawHtml {
let plus_index = p.join("index.html");
let file = UI_DIR_FILES
.get_file(&p)
.map(|v| RawHtml {
data: v.contents().to_vec(),
name: p,
});
})
.or(UI_DIR_FILES.get_file(&plus_index).map(|v| RawHtml {
data: v.contents().to_vec(),
name: plus_index,
}));
file.respond_to(req).or_forward((data, Status::NotFound))
}
}