From bf1a6ec8985ba801a9c7c2b321c98d38c9e6228a Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 18 Aug 2024 00:54:56 +0300 Subject: Parse redirect URIs from MF2 metadata --- src/indieauth/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/indieauth/mod.rs b/src/indieauth/mod.rs index e466d98..f7a9712 100644 --- a/src/indieauth/mod.rs +++ b/src/indieauth/mod.rs @@ -154,7 +154,7 @@ async fn authorization_endpoint_get( let text = response.text().await.unwrap(); tracing::debug!("Received {} bytes in response", text.len()); match microformats::from_html(&text, url) { - Ok(mf2) => { + Ok(mut mf2) => { if let Some(relation) = mf2.rels.items.get(&request.redirect_uri) { if !relation.rels.iter().any(|i| i == "redirect_uri") { return (StatusCode::BAD_REQUEST, @@ -200,6 +200,8 @@ async fn authorization_endpoint_get( _ => None }); + metadata.redirect_uris = mf2.rels.by_rels().remove("redirect_uri"); + metadata } else { return (StatusCode::BAD_REQUEST, [("Content-Type", "text/plain")], "No h-app or JSON application metadata found.").into_response() -- cgit 1.4.1