aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/webfinger.go14
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",
}},
}