1
Fork 0

webfinger: Use the subject field to determine the canonical name of the subject

This commit is contained in:
Steffo 2024-11-16 07:49:28 +01:00
parent 219880f3d3
commit cc6dfd0dfc
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -74,6 +74,8 @@ pub async fn webfinger_handler(
return Ok(response);
}
let subject = subject.subject.clone();
let aliases = MetaAlias::query_matching(&mut conn, WEBFINGER_DOC, &resource)
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
@ -127,8 +129,6 @@ pub async fn webfinger_handler(
match mime {
"*/*" | "application/json" | "application/jrd+json" => {
let subject = Some(resource);
let aliases = aliases
.into_iter()
.map(|alias| alias.alias)
@ -175,8 +175,6 @@ pub async fn webfinger_handler(
return Ok(response);
},
"application/xml" | "application/xrd+xml" => {
let subject = Some(resource);
let aliases = aliases
.into_iter()
.map(|alias| alias.alias)
@ -265,7 +263,7 @@ pub async fn webfinger_handler(
.expect("webfinger.html.j2 to exist")
.render(
minijinja::context!(
subject => resource,
subject => subject,
aliases => aliases,
properties => properties,
links => links,