diff --git a/Makefile b/Makefile index 7d2b5a1e..b502a1d5 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ build_init: build_frontend: NODE_ENV=production npm run build + mkdir -p ./server/ctrl/static/www/canary/ + cp -R ./public/assets ./server/ctrl/static/www/canary/ + cp -R ./public/*.html ./server/ctrl/static/www/canary/ build_backend: CGO_ENABLED=1 go build --tags "fts5" -o dist/filestash cmd/main.go diff --git a/server/ctrl/static.go b/server/ctrl/static.go index c4eacbbd..daa32fff 100644 --- a/server/ctrl/static.go +++ b/server/ctrl/static.go @@ -98,11 +98,22 @@ func LegacyServeFile(res http.ResponseWriter, req *http.Request, filePath string continue } curPath := filePath + cfg.FileExt - file, err := WWWEmbed.Open("static/www" + curPath) - if env := os.Getenv("DEBUG"); env == "true" { - file, err = WWWDir.Open("server/ctrl/static/www" + curPath) - } else if os.Getenv("CANARY") != "" { - file, err = WWWDir.Open("public" + curPath) + var ( + file fs.File + err error + ) + if os.Getenv("CANARY") == "true" { // TODO: remove legacy option + if env := os.Getenv("DEBUG"); env == "true" { + file, err = WWWDir.Open("public" + curPath) + } else { + file, err = WWWEmbed.Open("static/www/canary" + curPath) + } + } else { + if env := os.Getenv("DEBUG"); env == "true" { + file, err = WWWDir.Open("server/ctrl/static/www" + curPath) + } else { + file, err = WWWEmbed.Open("static/www" + curPath) + } } if err != nil { continue