From 6de1cd00cea3479a7a33418eebbc9399f77178c6 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Sun, 18 Dec 2022 19:45:27 -0500 Subject: start of outbox --- resources/outbox.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 resources/outbox.go (limited to 'resources') diff --git a/resources/outbox.go b/resources/outbox.go new file mode 100644 index 0000000..9adb817 --- /dev/null +++ b/resources/outbox.go @@ -0,0 +1,25 @@ +package resources + +import ( + "fmt" + "net/url" + "path" + + "github.com/go-fed/activity/streams" +) + +func RenderOutbox(name, domain string) (map[string]interface{}, error) { + 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() + + ocProp := streams.NewActivityStreamsFirstProperty() + ocProp.SetIRI(first) + + oc.SetActivityStreamsFirst(ocProp) + + return oc.Serialize() +} -- cgit v1.2.3