aboutsummaryrefslogtreecommitdiff
path: root/resources/outbox.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-19 15:41:43 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-19 15:41:43 +0000
commitafdf8a014236452e098ab1266c9a9315824f8103 (patch)
tree0c1db202f6f5c81783d7d2ccb1502443ab84a8ae /resources/outbox.go
parent2211d7ace360548f6ee450f03d995c6bb246be2b (diff)
downloadcommunique-afdf8a014236452e098ab1266c9a9315824f8103.tar.gz
url helpers, cgi response format
Diffstat (limited to 'resources/outbox.go')
-rw-r--r--resources/outbox.go21
1 files changed, 9 insertions, 12 deletions
diff --git a/resources/outbox.go b/resources/outbox.go
index 4dd022b..93bed92 100644
--- a/resources/outbox.go
+++ b/resources/outbox.go
@@ -1,23 +1,20 @@
package resources
import (
- "fmt"
- "net/url"
- "path"
-
+ "git.capotej.com/capotej/communique/urls"
"github.com/dgraph-io/badger/v3"
"github.com/go-fed/activity/streams"
)
func RenderOutboxPage(name, domain string, db *badger.DB) (map[string]interface{}, error) {
- id, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox") + "?page=true")
+ id, err := urls.UrlOutboxPage(name, domain)
if err != nil {
- return nil, fmt.Errorf("could not partse url: %w", err)
+ return nil, err
}
- partOf, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox"))
+ partOf, err := urls.UrlOutbox(name, domain)
if err != nil {
- return nil, fmt.Errorf("could not partse url: %w", err)
+ return nil, err
}
oc := streams.NewActivityStreamsOrderedCollectionPage()
@@ -69,15 +66,15 @@ func RenderOutboxPage(name, domain string, db *badger.DB) (map[string]interface{
}
func RenderOutbox(name, domain string, db *badger.DB) (map[string]interface{}, error) {
- id, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox") + "?page=true")
+ id, err := urls.UrlOutbox(name, domain)
if err != nil {
- return nil, fmt.Errorf("could not partse url: %w", err)
+ return nil, err
}
- first, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox") + "?page=true")
+ first, err := urls.UrlOutboxPage(name, domain)
if err != nil {
- return nil, fmt.Errorf("could not partse url: %w", err)
+ return nil, err
}
oc := streams.NewActivityStreamsOrderedCollection()