diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-02 14:32:41 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-02 14:32:41 +0000 |
commit | 9027aba0621018caf177611d9105213645efe491 (patch) | |
tree | dde99a394273708c231332ae9fc9fb1ff273826a /views/webfinger.go | |
parent | 91a081a2bc16540c37ac76a719ab4dd79608ed5d (diff) | |
download | communique-9027aba0621018caf177611d9105213645efe491.tar.gz |
fix webfinger
Diffstat (limited to '')
-rw-r--r-- | views/webfinger.go | 14 |
1 files changed, 9 insertions, 5 deletions
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", }}, } |