routes: serve static content from /static
1 file changed, 4 insertions(+), 4 deletions(-)
changed files
M routes/template.go → routes/template.go
@@ -13,7 +13,7 @@ "icyphox.sh/legit/git" ) func (d *deps) Write404(w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) w.WriteHeader(404) if err := t.ExecuteTemplate(w, "404", nil); err != nil {@@ -22,7 +22,7 @@ } } func (d *deps) Write500(w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) w.WriteHeader(500) if err := t.ExecuteTemplate(w, "500", nil); err != nil {@@ -31,7 +31,7 @@ } } func (d *deps) listFiles(files []git.NiceTree, data map[string]any, w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) data["files"] = files@@ -62,7 +62,7 @@ } } func (d *deps) showFile(content string, data map[string]any, w http.ResponseWriter) { - tpath := filepath.Join(d.c.Template.Dir, "*") + tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) lc, err := countLines(strings.NewReader(content))