aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorgammelalf <gammelalf@hopfen.space>2023-01-23 03:12:21 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2023-02-24 12:47:40 +0100
commit7b9d908d2c1612843990dd39decbdbf40e51dbd7 (patch)
tree540f2c6aaf25f9251e4666dc56f0afbf85b2944c /main.go
parent95f95783383a58af5250bcb66155a04971385b75 (diff)
downloadWRMS-7b9d908d2c1612843990dd39decbdbf40e51dbd7.tar.gz
WRMS-7b9d908d2c1612843990dd39decbdbf40e51dbd7.zip
Reimplemented current frontend in svelte
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 2 insertions, 13 deletions
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() {