aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--registry/registry.go10
-rw-r--r--resources/profile.go12
2 files changed, 20 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{{
diff --git a/resources/profile.go b/resources/profile.go
new file mode 100644
index 0000000..207f4de
--- /dev/null
+++ b/resources/profile.go
@@ -0,0 +1,12 @@
+package resources
+
+type Profile struct {
+ Context []string `json:"@context"`
+}
+
+func RenderProfile() *Profile {
+ p := Profile{
+ Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"},
+ }
+ return &p
+}