From da58a5926dc68e608a6a2b8d791dd564f82efcb0 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Thu, 17 Oct 2024 16:08:29 +0200 Subject: [PATCH] removing some old garbage --- depell/src/main.rs | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/depell/src/main.rs b/depell/src/main.rs index 3aa6fd7..969d8b5 100644 --- a/depell/src/main.rs +++ b/depell/src/main.rs @@ -3,7 +3,7 @@ use { argon2::{password_hash::SaltString, PasswordVerifier}, axum::{ body::Bytes, - extract::{OriginalUri, Path}, + extract::Path, http::{header::COOKIE, request::Parts}, response::{AppendHeaders, Html}, }, @@ -349,16 +349,8 @@ impl Profile { Profile { other: Some(name) }.render(&session) } - async fn get_other_page( - session: Session, - path: axum::extract::OriginalUri, - Path(name): Path, - ) -> Html { - base( - |b| Profile { other: Some(name) }.render_to_buf(&session, b), - path.path(), - Some(&session), - ) + async fn get_other_page(session: Session, Path(name): Path) -> Html { + base(|b| Profile { other: Some(name) }.render_to_buf(&session, b), Some(&session)) } } @@ -542,7 +534,7 @@ impl Signup { } } -fn base(body: impl FnOnce(&mut String), path: &str, session: Option<&Session>) -> Html { +fn base(body: impl FnOnce(&mut String), session: Option<&Session>) -> Html { let username = session.map(|s| &s.name); let nav_button = |f: &mut String, name: &str| { @@ -761,8 +753,8 @@ trait PublicPage: Default { Self::default().render() } - async fn page(uri: OriginalUri, session: Option) -> Html { - base(|s| Self::default().render_to_buf(s), uri.path(), session.as_ref()) + async fn page(session: Option) -> Html { + base(|s| Self::default().render_to_buf(s), session.as_ref()) } } @@ -779,13 +771,10 @@ trait Page: Default { Self::default().render(&session) } - async fn page( - uri: OriginalUri, - session: Option, - ) -> Result, axum::response::Redirect> { + async fn page(session: Option) -> Result, axum::response::Redirect> { match session { Some(session) => { - Ok(base(|f| Self::default().render_to_buf(&session, f), uri.path(), Some(&session))) + Ok(base(|f| Self::default().render_to_buf(&session, f), Some(&session))) } None => Err(axum::response::Redirect::permanent("/login")), }