From 1b636ef51a835af06cb7f2310941afd74e0b7ad7 Mon Sep 17 00:00:00 2001 From: whoswhip Date: Tue, 10 Nov 2026 22:26:08 -0500 Subject: [PATCH] fuck. list expiries + accept post form expiry --- handlers.go | 6 ++++-- main.go | 3 +-- templates/home.html | 12 +++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/handlers.go b/handlers.go index a4442a0..9edb26a 100644 --- a/handlers.go +++ b/handlers.go @@ -23,8 +23,7 @@ import ( ) type HomePageData struct { - Title string - Description string + Expiries []Expiry } func health(w http.ResponseWriter, r *http.Request) { @@ -71,6 +70,9 @@ func uploadHandler(db *gorm.DB, cfg Config) http.HandlerFunc { } expLabel := r.URL.Query().Get("expiry") + if expLabel == "" { + expLabel = r.PostFormValue("expiry") // html form request + } if expLabel == "" { expLabel = cfg.Expiries[0].Label } diff --git a/main.go b/main.go index a0fbd5b..8731e61 100644 --- a/main.go +++ b/main.go @@ -35,8 +35,7 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) { data := HomePageData{ - Title: "minibin", - Description: "simple file and paste hosting", + Expiries: config.Expiries, } w.Header().Set("Content-Type", "text/html; charset=utf-8") diff --git a/templates/home.html b/templates/home.html index dec7047..b66c36b 100644 --- a/templates/home.html +++ b/templates/home.html @@ -3,14 +3,20 @@ - {{.Title}} + minibin -

{{.Title}}

-

{{.Description}}

+

minibin

+

simple file and paste hosting service

+ +