From 9027aba0621018caf177611d9105213645efe491 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Mon, 2 Jan 2023 09:32:41 -0500 Subject: fix webfinger --- views/webfinger.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'views') diff --git a/views/webfinger.go b/views/webfinger.go index 4252bae..5af6308 100644 --- a/views/webfinger.go +++ b/views/webfinger.go @@ -2,7 +2,8 @@ package views import ( "fmt" - "path" + + "git.capotej.com/capotej/communique/urls" ) type Link struct { @@ -17,14 +18,17 @@ type WebfingerResource struct { Links []Link `json:"links"` } -func RenderWebfingerResource(name, domain string) (*WebfingerResource, error) { +func RenderWebfinger(name, domain, hostname string) (*WebfingerResource, error) { + actorUrl, err := urls.UrlProfile(name, domain) + if err != nil { + return nil, err + } rs := WebfingerResource{ - // TODO clean up - Subject: fmt.Sprintf("acct:%s@%s", name, domain), + Subject: fmt.Sprintf("acct:%s%s", name, hostname), //hostname contains @ Aliases: []string{}, Links: []Link{{ Rel: "self", - Href: path.Join("https://", domain, "actors", name), + Href: actorUrl.String(), Type: "application/activity+json", }}, } -- cgit v1.2.3