diff options
Diffstat (limited to 'http/router.go')
-rw-r--r-- | http/router.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/http/router.go b/http/router.go index 4c251df..6a43499 100644 --- a/http/router.go +++ b/http/router.go @@ -2,6 +2,7 @@ package http import ( "bytes" + "fmt" "io" "net/http" @@ -57,6 +58,17 @@ func (s *Router) Start(zapWriter io.Writer) { render(c, resource, err) }) + // Actor avatar + router.GET("/actors/:actor/avatar", func(c *gin.Context) { + actorParam := c.Param("actor") + avatarBytes, mediaType, err := s.registry.ActorAvatar(actorParam) + if err != nil || avatarBytes == nil || mediaType == "" { + c.Data(404, "text/plain", []byte("404 page not found")) + } + c.Header("Content-Length", fmt.Sprintf("%d", len(avatarBytes))) + c.Data(200, mediaType, avatarBytes) + }) + // Actor Followers router.GET("/actors/:actor/followers", func(c *gin.Context) { actorParam := c.Param("actor") |