From 9efe9352389281c7c28b858f45a3891069f0b4ea Mon Sep 17 00:00:00 2001 From: Natty Date: Sat, 22 Apr 2023 02:53:37 +0200 Subject: [PATCH] Made RelSelf resolve for local accounts --- src/webfinger.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/webfinger.rs b/src/webfinger.rs index 6f51c40..fa0b91f 100644 --- a/src/webfinger.rs +++ b/src/webfinger.rs @@ -73,7 +73,15 @@ pub async fn handle_webfinger( let mut aliases = Vec::new(); match tag.host { - Some(ref host) if host != &config.networking.host => {} + Some(ref host) if host != &config.networking.host => { + if let Some(uri) = user.uri { + links.push(WebFingerRel::RelSelf { + rel: RelSelf, + content_type: ContentActivityStreams, + href: uri, + }); + } + } _ => { links.push(WebFingerRel::RelOStatusSubscribe { rel: RelOStatusSubscribe, @@ -95,15 +103,16 @@ pub async fn handle_webfinger( }); aliases.push(WebFingerSubject::Url(user_url)); - } - } - if let Some(uri) = user.uri { - links.push(WebFingerRel::RelSelf { - rel: RelSelf, - content_type: ContentActivityStreams, - href: uri, - }); + links.push(WebFingerRel::RelSelf { + rel: RelSelf, + content_type: ContentActivityStreams, + href: format!( + "{}://{}/users/{}", + config.networking.protocol, config.networking.host, user.id + ), + }); + } } Ok((