summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2026-01-17 03:07:06 +0200
committerMarin Ivanov <[email protected]>2026-01-17 03:07:06 +0200
commit044ad65b3e9b6169741e237d4ad04406b4875c13 (patch)
treea54738000bb3030f3d8792490569ca88f0f69c11 /main.go
parentdcec8b701f13bd7510423985aa2e570e4b425390 (diff)
combine result and form into single template
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.go b/main.go
index 24ce456..597726b 100644
--- a/main.go
+++ b/main.go
@@ -36,7 +36,7 @@ type Metadata struct {
ContentType string `json:"contentType"`
}
-//go:embed form.html result.html
+//go:embed template.html
var static embed.FS
var tmpl = template.Must(template.ParseFS(static, "*.html"))
@@ -218,7 +218,7 @@ func (s *Server) post(w http.ResponseWriter, r *http.Request) {
"TextLink": textLink,
"FileLink": fileLink,
}
- if err := tmpl.ExecuteTemplate(w, "result.html", tmplData); err != nil {
+ if err := tmpl.ExecuteTemplate(w, "template.html", tmplData); err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
} else {
@@ -241,7 +241,7 @@ func (s *Server) get(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
if path == "/" {
w.Header().Add("content-type", "text/html; charset=UTF-8")
- if err := tmpl.ExecuteTemplate(w, "form.html", nil); err != nil {
+ if err := tmpl.ExecuteTemplate(w, "template.html", map[string]any{"Form": true}); err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
} else {