fix bug/webinfo-add custom template

This commit is contained in:
Aynakeya
2022-07-19 18:09:44 -07:00
parent f6b58a3e9d
commit 05c44079e2
9 changed files with 100 additions and 27 deletions

View File

@@ -19,13 +19,14 @@ type TemplateStore struct {
func newTemplateStore(filename string) *TemplateStore {
s := &TemplateStore{Templates: map[string]*WebTemplate{}}
var templates []WebTemplate
var templates []*WebTemplate
file, err := ioutil.ReadFile(filename)
if err == nil {
_ = json.Unmarshal(file, &templates)
}
for _, tmpl := range templates {
s.Templates[tmpl.Name] = &tmpl
s.Templates[tmpl.Name] = tmpl
}
return s
}