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 @@
-{{.Description}}
+simple file and paste hosting service