aboutsummaryrefslogtreecommitdiff
path: root/resources/profile.go
diff options
context:
space:
mode:
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()
}