diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-18 23:51:00 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-18 23:51:00 +0000 |
commit | 4f8325f5df55628544f13937975f38c6ef5d17ab (patch) | |
tree | 9e977ba3b3edbcf3cb900442dbd5c5659d39a4a3 /resources | |
parent | f0efb48bbd45ffd149cd9eb0603f7916ab9d8b67 (diff) | |
download | communique-4f8325f5df55628544f13937975f38c6ef5d17ab.tar.gz |
switch to using go-fed for activitystreams
Diffstat (limited to '')
-rw-r--r-- | resources/profile.go | 37 |
1 files changed, 17 insertions, 20 deletions
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() } |