diff options
author | Vika <vika@fireburn.ru> | 2024-08-18 00:54:56 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-08-18 00:54:56 +0300 |
commit | bf1a6ec8985ba801a9c7c2b321c98d38c9e6228a (patch) | |
tree | 6c4a136bc207fa374a443efc44ff72275f28eb2d /src/indieauth | |
parent | 1bca8bb790b686aac4eaccdffa4994c630b454d7 (diff) | |
download | kittybox-bf1a6ec8985ba801a9c7c2b321c98d38c9e6228a.tar.zst |
Parse redirect URIs from MF2 metadata
Diffstat (limited to 'src/indieauth')
-rw-r--r-- | src/indieauth/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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<A: AuthBackend, D: Storage + 'static>( 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<A: AuthBackend, D: Storage + 'static>( _ => 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() |