diff options
author | Vika <vika@fireburn.ru> | 2025-01-03 13:34:21 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-01-03 13:35:24 +0300 |
commit | 9e996d892f3896744d0e8999ed3fc5528c607375 (patch) | |
tree | 86d276d43eef0e441b6e272bf5c4c832940e6456 /src/bin/kittybox-indieauth-helper.rs | |
parent | bbfca3190f3c3cac5eefd74ed30d0c4b14f08f0c (diff) | |
download | kittybox-9e996d892f3896744d0e8999ed3fc5528c607375.tar.zst |
kittybox-indieauth-helper: fix handler types
Change-Id: I991a3b935b4ae435acd852ee62a8d2893cf00950
Diffstat (limited to 'src/bin/kittybox-indieauth-helper.rs')
-rw-r--r-- | src/bin/kittybox-indieauth-helper.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/bin/kittybox-indieauth-helper.rs b/src/bin/kittybox-indieauth-helper.rs index e7004c0..f4ad679 100644 --- a/src/bin/kittybox-indieauth-helper.rs +++ b/src/bin/kittybox-indieauth-helper.rs @@ -125,23 +125,19 @@ async fn main() -> Result<(), Error> { let router = axum::Router::new() .route("/callback", axum::routing::get( - move |query: Option<Query<AuthorizationResponse>>| async move { - if let Some(Query(response)) = query { - if let Some(tx) = tx.lock_owned().await.take() { - tx.send(response).unwrap(); - - (axum::http::StatusCode::OK, - [("Content-Type", "text/plain")], - "Thank you! This window can now be closed.") - .into_response() - } else { - (axum::http::StatusCode::BAD_REQUEST, - [("Content-Type", "text/plain")], - "Oops. The callback was already received. Did you click twice?") - .into_response() - } + move |Query(response): Query<AuthorizationResponse>| async move { + if let Some(tx) = tx.lock_owned().await.take() { + tx.send(response).unwrap(); + + (axum::http::StatusCode::OK, + [("Content-Type", "text/plain")], + "Thank you! This window can now be closed.") + .into_response() } else { - axum::http::StatusCode::BAD_REQUEST.into_response() + (axum::http::StatusCode::BAD_REQUEST, + [("Content-Type", "text/plain")], + "Oops. The callback was already received. Did you click twice?") + .into_response() } } )); |