aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http/server.go11
-rw-r--r--registry/registry.go9
2 files changed, 18 insertions, 2 deletions
diff --git a/http/server.go b/http/server.go
index 6d68d0e..c720a6d 100644
--- a/http/server.go
+++ b/http/server.go
@@ -33,5 +33,16 @@ func (s *Server) Start(zapWriter io.Writer) {
})
+ router.GET("/actors/:actor", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ resource := s.registry.LookupByName(actorParam)
+ if resource != nil {
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+
+ })
+
router.Run()
}
diff --git a/registry/registry.go b/registry/registry.go
index 04c4565..fc0e9d9 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -26,8 +26,13 @@ func NewRegistry(cfg config.Config) *Registry {
return &reg
}
-func (r *Registry) LookupResource(name string) *webfinger.Resource {
- handler, ok := r.handlerMap[name]
+func (r *Registry) LookupByName(name string) *webfinger.Resource {
+ fqdn := fmt.Sprintf("acct:%s@%s", name, r.cfg.Domain)
+ return r.LookupResource(fqdn)
+}
+
+func (r *Registry) LookupResource(fqdn string) *webfinger.Resource {
+ handler, ok := r.handlerMap[fqdn]
if !ok {
return nil
}