diff --git a/Makefile b/Makefile index a53cbe2..ff2b4e0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BINARY=syncserver -VERSION?=1.0.2 +VERSION?=1.0.3 GO?=go LDFLAGS=-s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) BUILD_FLAGS=CGO_ENABLED=0 diff --git a/cmd/server/main.go b/cmd/server/main.go index 68eebb8..570320f 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -20,7 +20,7 @@ import ( "github.com/syncserver/internal/syncengine" ) -var version = "1.0.2" +var version = "1.0.3" func main() { cfgPath := flag.String("config", "", "Path to config.yaml") diff --git a/internal/webui/embed.go b/internal/webui/embed.go index 51140dd..cd4359e 100644 --- a/internal/webui/embed.go +++ b/internal/webui/embed.go @@ -9,15 +9,19 @@ import ( //go:embed dist var DistFS embed.FS -var Dist fs.FS = DistFS +var distSub, _ = fs.Sub(DistFS, "dist") func ServeHTTP() http.Handler { - return http.FileServer(http.FS(DistFS)) + return http.FileServer(http.FS(distSub)) } func ServeSPA() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { path := r.URL.Path + if path == "/favicon.ico" { + w.WriteHeader(http.StatusNoContent) + return + } if path == "/" || !isStaticAsset(path) { data, err := DistFS.ReadFile("dist/index.html") if err != nil { @@ -28,7 +32,7 @@ func ServeSPA() http.Handler { w.Write(data) return } - http.StripPrefix("/", http.FileServer(http.FS(DistFS))).ServeHTTP(w, r) + http.FileServer(http.FS(distSub)).ServeHTTP(w, r) }) }