aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-19 02:23:36 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-19 02:23:36 +0000
commit326eef243c22a739588cfb74642eb9267d020dee (patch)
tree56c4338ae2f9dffc2154ca91087848e5e7538418 /resources
parent6de1cd00cea3479a7a33418eebbc9399f77178c6 (diff)
downloadcommunique-326eef243c22a739588cfb74642eb9267d020dee.tar.gz
use streams.Serialize
Diffstat (limited to '')
-rw-r--r--resources/outbox.go11
-rw-r--r--resources/profile.go2
2 files changed, 11 insertions, 2 deletions
diff --git a/resources/outbox.go b/resources/outbox.go
index 9adb817..f9a4aef 100644
--- a/resources/outbox.go
+++ b/resources/outbox.go
@@ -9,17 +9,26 @@ import (
)
func RenderOutbox(name, domain string) (map[string]interface{}, error) {
+ id, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox"))
+
+ if err != nil {
+ return nil, fmt.Errorf("could not partse url: %w", err)
+ }
+
first, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox", "?=page=true"))
if err != nil {
return nil, fmt.Errorf("could not partse url: %w", err)
}
oc := streams.NewActivityStreamsOrderedCollection()
+ idProp := streams.NewJSONLDIdProperty()
+ idProp.Set(id)
+ oc.SetJSONLDId(idProp)
ocProp := streams.NewActivityStreamsFirstProperty()
ocProp.SetIRI(first)
oc.SetActivityStreamsFirst(ocProp)
- return oc.Serialize()
+ return streams.Serialize(oc)
}
diff --git a/resources/profile.go b/resources/profile.go
index 090075c..b62a9c5 100644
--- a/resources/profile.go
+++ b/resources/profile.go
@@ -20,5 +20,5 @@ func RenderProfile(name, domain string) (map[string]interface{}, error) {
p := streams.NewActivityStreamsService()
p.SetActivityStreamsInbox(inb)
- return p.Serialize()
+ return streams.Serialize(p)
}