From 2ee94a66d89de9eb0461f250251af7776aef9976 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Sun, 18 Dec 2022 19:29:19 -0500 Subject: cleanup --- resources/webfinger.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'resources/webfinger.go') diff --git a/resources/webfinger.go b/resources/webfinger.go index d936519..e7c47ea 100644 --- a/resources/webfinger.go +++ b/resources/webfinger.go @@ -1,5 +1,10 @@ package resources +import ( + "fmt" + "path" +) + type Link struct { Rel string `json:"rel"` Type string `json:"type"` @@ -11,3 +16,17 @@ type WebfingerResource struct { Aliases []string `json:"aliases"` Links []Link `json:"links"` } + +func RenderWebfingerResource(name, domain string) (*WebfingerResource, error) { + rs := WebfingerResource{ + // TODO clean up + Subject: fmt.Sprintf("acct:%s@%s", name, domain), + Aliases: []string{}, + Links: []Link{{ + Rel: "self", + Href: path.Join("https://", domain, "actors", name), + Type: "application/activity+json", + }}, + } + return &rs, nil +} -- cgit v1.2.3