diff options
| author | gammelalf <gammelalf@hopfen.space> | 2023-01-23 03:12:21 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-24 12:47:40 +0100 |
| commit | 7b9d908d2c1612843990dd39decbdbf40e51dbd7 (patch) | |
| tree | 540f2c6aaf25f9251e4666dc56f0afbf85b2944c /main.go | |
| parent | 95f95783383a58af5250bcb66155a04971385b75 (diff) | |
| download | WRMS-7b9d908d2c1612843990dd39decbdbf40e51dbd7.tar.gz WRMS-7b9d908d2c1612843990dd39decbdbf40e51dbd7.zip | |
Reimplemented current frontend in svelte
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -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() { |
