aboutsummaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-30 03:32:16 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-30 03:32:16 +0000
commit74ffcfe6b2c80b7cf459798dc42bd278075ccb50 (patch)
tree231880fb4de3cf900d03c33531d2afc9603432d3 /http
parenta4288b06bf13210721c8f2fae64bc12c118f9041 (diff)
downloadcommunique-74ffcfe6b2c80b7cf459798dc42bd278075ccb50.tar.gz
experiment with write JSON to database and munge it for collections
Diffstat (limited to 'http')
-rw-r--r--http/server.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/http/server.go b/http/server.go
index b02e5c9..78d916c 100644
--- a/http/server.go
+++ b/http/server.go
@@ -62,15 +62,18 @@ func (s *Server) Start(zapWriter io.Writer) {
// Outbox
router.GET("/actors/:actor/outbox", func(c *gin.Context) {
actorParam := c.Param("actor")
- var resource map[string]interface{}
+ var found bool
if c.Query("page") == "true" {
- resource, _ = s.registry.OutboxPage(actorParam)
+ resource, _ := s.registry.OutboxCollection(actorParam)
+ c.String(http.StatusOK, resource)
+ found = true
} else {
- resource, _ = s.registry.Outbox(actorParam)
+ resource, _ := s.registry.Outbox(actorParam)
+ c.JSON(http.StatusOK, resource)
+ found = true
}
- if resource != nil {
+ if found {
c.Writer.Header().Set("Content-Type", "application/activity+json")
- c.JSON(http.StatusOK, resource)
} else {
c.JSON(http.StatusNotFound, nil)
}