Web Design Update

This commit is contained in:
2026-05-10 18:22:19 +00:00
parent 131dec501a
commit 8d9d29cff1
4 changed files with 121 additions and 12 deletions
+11
View File
@@ -76,6 +76,7 @@ async fn main() {
let app = Router::new()
.route("/", get(list_files))
.route("/image.png", get(serve_image))
.route("/download/:file_id", get(download_file))
.route("/health", get(health_check))
.layer(middleware::from_fn_with_state(
@@ -207,6 +208,16 @@ async fn health_check() -> impl IntoResponse {
(StatusCode::OK, "OK")
}
async fn serve_image() -> impl IntoResponse {
match tokio::fs::read("templates/image.png").await {
Ok(bytes) => (
[(header::CONTENT_TYPE, "image/png")],
bytes,
).into_response(),
Err(_) => StatusCode::NOT_FOUND.into_response(),
}
}
async fn list_files(State(state): State<AppState>) -> Html<String> {
// Read template from file
let template_path = "templates/index.html";