From e0c12600ee090fa360be7e56446b9212a3cbd3b3 Mon Sep 17 00:00:00 2001 From: ozpv <39195175+ozpv@users.noreply.github.com> Date: Fri, 29 May 2026 21:56:55 -0500 Subject: lots of work --- src/main.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index aa6dbe5..aaa9756 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,15 +27,6 @@ async fn inject( after: &'static str, state: AppState, ) -> impl IntoResponse { - if !res - .headers() - .get(header::CONTENT_TYPE) - .and_then(|value| value.to_str().ok()) - .is_some_and(|value| value.contains("text/html")) - { - return res; - } - let (parts, body) = res.into_parts(); let Ok(body) = body::to_bytes(body, 5_000_000).await else { @@ -106,6 +97,16 @@ async fn get_try_inject_head_nav_footer( req: Request, ) -> impl IntoResponse { let res = get_file(State(state.clone()), req).await.into_response(); + + if !res + .headers() + .get(header::CONTENT_TYPE) + .and_then(|value| value.to_str().ok()) + .is_some_and(|value| value.contains("text/html")) + { + return res; + } + let res = inject(res, "head.html", "", state.clone()) .await .into_response(); @@ -113,7 +114,7 @@ async fn get_try_inject_head_nav_footer( .await .into_response(); - inject(res, "footer.html", "", state.clone()).await + inject(res, "footer.html", "", state.clone()).await.into_response() } #[tokio::main] -- cgit v1.2.3