From 46ff9c7aeed91182241d1ce1c7e95ace25d8e57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Fri, 15 May 2026 00:06:51 +0200 Subject: [PATCH] dashboard: error_response takes &str --- Cargo.lock | 7 +++++++ hive-c0re/src/dashboard.rs | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe9c026..189080c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -325,6 +325,7 @@ dependencies = [ "rusqlite", "serde", "serde_json", + "similar", "tokio", "tracing", "tracing-subscriber", @@ -681,6 +682,12 @@ dependencies = [ "libc", ] +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + [[package]] name = "slab" version = "0.4.12" diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index 1178936..535b981 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -67,23 +67,23 @@ async fn post_approve( ) -> Response { match actions::approve(&state.coord, id).await { Ok(()) => Redirect::to("/").into_response(), - Err(e) => error_response(format!("approve {id} failed: {e:#}")), + Err(e) => error_response(&format!("approve {id} failed: {e:#}")), } } async fn post_deny(State(state): State, AxumPath(id): AxumPath) -> Response { match actions::deny(&state.coord, id) { Ok(()) => Redirect::to("/").into_response(), - Err(e) => error_response(format!("deny {id} failed: {e:#}")), + Err(e) => error_response(&format!("deny {id} failed: {e:#}")), } } -fn error_response(message: String) -> Response { +fn error_response(message: &str) -> Response { ( StatusCode::INTERNAL_SERVER_ERROR, Html(format!( "\n\n{STYLE}\n{BANNER}\n

◆ ERR0R ◆

\n
{message}
\n

← back

\n", - message = html_escape(&message), + message = html_escape(message), )), ) .into_response()