From 4f8325f5df55628544f13937975f38c6ef5d17ab Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Sun, 18 Dec 2022 18:51:00 -0500 Subject: switch to using go-fed for activitystreams --- resources/profile.go | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'resources') diff --git a/resources/profile.go b/resources/profile.go index 83b2159..23b2844 100644 --- a/resources/profile.go +++ b/resources/profile.go @@ -1,26 +1,23 @@ package resources -import "path" +import ( + "net/url" + "path" -type Profile struct { - Context []string `json:"@context"` - Type string `json:"type"` - Id string `json:"id"` - Inbox string `json:"inbox"` - Outbox string `json:"outbox"` - Summary string `json:"summary"` - Username string `json:"preferredUsername"` -} - -type PublicKey struct { -} + "github.com/go-fed/activity/streams" +) -func RenderProfile(name, domain string) *Profile { - p := Profile{ - Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}, - Type: "Service", - Inbox: path.Join("https://", domain, "actors", name, "inbox"), - Outbox: path.Join("https://", domain, "actors", name, "outbox"), +func RenderProfile(name, domain string) (map[string]interface{}, error) { + u, err := url.Parse(path.Join("https://", domain, "actors", name, "inbox")) + if err != nil { + panic(err) } - return &p + + inb := streams.NewActivityStreamsInboxProperty() + inb.SetIRI(u) + + p := streams.NewActivityStreamsService() + p.SetActivityStreamsInbox(inb) + + return p.Serialize() } -- cgit v1.2.3