aboutsummaryrefslogtreecommitdiff
path: root/resources/profile.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-18 23:51:00 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-18 23:51:00 +0000
commit4f8325f5df55628544f13937975f38c6ef5d17ab (patch)
tree9e977ba3b3edbcf3cb900442dbd5c5659d39a4a3 /resources/profile.go
parentf0efb48bbd45ffd149cd9eb0603f7916ab9d8b67 (diff)
downloadcommunique-4f8325f5df55628544f13937975f38c6ef5d17ab.tar.gz
switch to using go-fed for activitystreams
Diffstat (limited to 'resources/profile.go')
-rw-r--r--resources/profile.go37
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()
}