From 9d870999909d533cc15fbeb8a5a41d7192473a49 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Fri, 30 Dec 2022 22:02:43 -0500 Subject: switch to storing encoded structs --- registry/registry.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'registry/registry.go') 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) { -- cgit v1.2.3