diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-31 03:02:43 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-31 03:02:43 +0000 |
commit | 9d870999909d533cc15fbeb8a5a41d7192473a49 (patch) | |
tree | 0d3809d8fb3e5217e913c5cc6752789cf1207e69 /registry | |
parent | c500a2be38afcbb5688537d97c7c3ee30a57dba4 (diff) | |
download | communique-9d870999909d533cc15fbeb8a5a41d7192473a49.tar.gz |
switch to storing encoded structs
Diffstat (limited to '')
-rw-r--r-- | registry/registry.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/registry/registry.go b/registry/registry.go index aac21d4..2518d55 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -1,6 +1,8 @@ package registry import ( + "bytes" + "encoding/gob" "fmt" "git.capotej.com/capotej/communique/config" @@ -58,7 +60,18 @@ func (r *Registry) OutboxCollection(name string) (map[string]interface{}, error) if err != nil { return nil, err } - return views.RenderOutboxCollection(handler.handlerCfg.Name, r.cfg.Domain, page) + var outboxItems []models.OutboxItem + for _, v := range page { + buf := bytes.NewBuffer(v) + dec := gob.NewDecoder(buf) + var outboxItem models.OutboxItem + err = dec.Decode(&outboxItem) + if err != nil { + return nil, err + } + outboxItems = append(outboxItems, outboxItem) + } + return views.RenderOutboxCollection(handler.handlerCfg.Name, r.cfg.Domain, outboxItems) } func (r *Registry) WebfingerResource(fqn string) (*views.WebfingerResource, error) { |