From 74ffcfe6b2c80b7cf459798dc42bd278075ccb50 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Thu, 29 Dec 2022 22:32:16 -0500 Subject: experiment with write JSON to database and munge it for collections --- http/server.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'http/server.go') 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) } -- cgit v1.2.3