From 7b9d908d2c1612843990dd39decbdbf40e51dbd7 Mon Sep 17 00:00:00 2001 From: gammelalf Date: Mon, 23 Jan 2023 03:12:21 +0100 Subject: Reimplemented current frontend in svelte --- main.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b68d7ae..6d7fc52 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,6 @@ import ( "encoding/json" "flag" "fmt" - "html/template" "io/ioutil" "net/http" @@ -19,17 +18,7 @@ import ( var wrms *Wrms func landingPage(w http.ResponseWriter, r *http.Request) { - if _, err := r.Cookie("UUID"); err != nil { - http.SetCookie(w, &http.Cookie{Name: "UUID", Value: uuid.NewString()}) - } - - t, err := template.ParseFiles("web/client.html") - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - t.Execute(w, "") + http.Redirect(w, r, "/static/index.html", 301) } func searchHandler(w http.ResponseWriter, r *http.Request) { @@ -209,7 +198,7 @@ func setupRoutes() { http.HandleFunc("/add", addHandler) http.HandleFunc("/playpause", playPauseHandler) http.HandleFunc("/ws", wsEndpoint) - http.Handle("/static/", http.FileServer(http.Dir("./web"))) + http.Handle("/static/", http.StripPrefix("/static", http.FileServer(http.Dir("./web/build")))) } func main() { -- cgit v1.2.3