aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgammelalf <gammelalf@hopfen.space>2023-01-24 12:36:44 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2023-02-24 12:47:40 +0100
commit5afc01e3de9b17df98c681acaa92779c44ed9738 (patch)
treee49d80bf06fe59341bd47fb0396f84a239b008d6
parent49a80e503325e2736d91c0c2bc6935572886d119 (diff)
downloadWRMS-5afc01e3de9b17df98c681acaa92779c44ed9738.tar.gz
WRMS-5afc01e3de9b17df98c681acaa92779c44ed9738.zip
Bodged missing cookie
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 6d7fc52..ccce08b 100644
--- a/main.go
+++ b/main.go
@@ -18,7 +18,11 @@ import (
var wrms *Wrms
func landingPage(w http.ResponseWriter, r *http.Request) {
- http.Redirect(w, r, "/static/index.html", 301)
+ if _, err := r.Cookie("UUID"); err != nil {
+ http.SetCookie(w, &http.Cookie{Name: "UUID", Value: uuid.NewString(), Path: "/",})
+ }
+
+ http.Redirect(w, r, "/static/index.html", http.StatusSeeOther)
}
func searchHandler(w http.ResponseWriter, r *http.Request) {