aboutsummaryrefslogtreecommitdiff
path: root/registry/registry.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-17 21:44:01 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-17 21:44:01 +0000
commitac88356c215309c10b7eeecd2b2c9ef3b5e970ec (patch)
treebc35756d2675820ad4630b072e6a149b91c5065a /registry/registry.go
parent0e1e52b457a452e1cf4f852b88288cb324165f54 (diff)
downloadcommunique-ac88356c215309c10b7eeecd2b2c9ef3b5e970ec.tar.gz
profile endpoint wip
Diffstat (limited to 'registry/registry.go')
-rw-r--r--registry/registry.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 438f821..e8ed66c 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -21,15 +21,20 @@ func NewRegistry(cfg config.Config) *Registry {
reg := Registry{cfg: cfg}
reg.handlerMap = make(map[string]Handler)
for _, v := range cfg.Handlers {
+ // TODO clean up
fqdn := fmt.Sprintf("acct:%s@%s", v.Name, cfg.Domain)
reg.handlerMap[fqdn] = Handler{handlerCfg: v}
}
return &reg
}
-func (r *Registry) LookupByName(name string) *resources.WebfingerResource {
+// TODO should probably be getprofilebyname
+func (r *Registry) LookupByName(name string) *resources.Profile {
fqdn := fmt.Sprintf("acct:%s@%s", name, r.cfg.Domain)
- return r.LookupResource(fqdn)
+ if r.LookupResource(fqdn) == nil {
+ return nil
+ }
+ return resources.RenderProfile()
}
func (r *Registry) LookupResource(fqdn string) *resources.WebfingerResource {
@@ -38,6 +43,7 @@ func (r *Registry) LookupResource(fqdn string) *resources.WebfingerResource {
return nil
}
rs := resources.WebfingerResource{
+ // TODO clean up
Subject: fmt.Sprintf("acct:%s@%s", handler.handlerCfg.Name, r.cfg.Domain),
Aliases: []string{},
Links: []resources.Link{{