aboutsummaryrefslogtreecommitdiff
path: root/http/router.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http/router.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/http/router.go b/http/router.go
index 04fa583..9730dbf 100644
--- a/http/router.go
+++ b/http/router.go
@@ -47,6 +47,28 @@ func (s *Router) Start(zapWriter io.Writer) {
})
+ router.GET("/actors/:actor/followers", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ resource, _ := s.registry.Followers(actorParam)
+ if resource != nil {
+ c.Writer.Header().Set("Content-Type", "application/activity+json")
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+ })
+
+ router.GET("/actors/:actor/following", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ resource, _ := s.registry.Following(actorParam)
+ if resource != nil {
+ c.Writer.Header().Set("Content-Type", "application/activity+json")
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+ })
+
// // Inbox
// router.POST("/actors/:actor/inbox", func(c *gin.Context) {
// actorParam := c.Param("actor")
@@ -81,7 +103,7 @@ func (s *Router) Start(zapWriter io.Writer) {
actorParam := c.Param("actor")
idParam := c.Param("id")
var resource map[string]interface{}
- resource, _ = s.registry.Activity(actorParam, idParam)
+ resource, _ = s.registry.ActivityOrNote("activity", actorParam, idParam)
if resource != nil {
c.Writer.Header().Set("Content-Type", "application/activity+json")
@@ -96,7 +118,7 @@ func (s *Router) Start(zapWriter io.Writer) {
actorParam := c.Param("actor")
idParam := c.Param("id")
var resource map[string]interface{}
- resource, _ = s.registry.Note(actorParam, idParam)
+ resource, _ = s.registry.ActivityOrNote("note", actorParam, idParam)
if resource != nil {
c.Writer.Header().Set("Content-Type", "application/activity+json")