diff --git a/cmd/http/main.go b/cmd/http/main.go index 2bb3c77..73bf947 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -1,6 +1,7 @@ package http import ( + "embed" "encoding/json" "flag" "fmt" @@ -16,12 +17,17 @@ import ( "strings" "time" + _ "embed" + "github.com/go-echarts/go-echarts/v2/charts" "github.com/go-echarts/go-echarts/v2/opts" "gogs.inhome.blapointe.com/ana-ledger/src/ana" "gogs.inhome.blapointe.com/ana-ledger/src/ledger" ) +//go:embed public/* +var staticFileDir embed.FS + func Main() { foo := flag.String("foo", "bal", "bal or reg") likeName := flag.String("like-name", ".", "regexp to match") @@ -55,7 +61,7 @@ func Main() { if *httpOutput != "" { foo := func(w http.ResponseWriter, r *http.Request) { if !strings.HasPrefix(r.URL.Path, "/api") { - http.FileServer(http.Dir("./http/public")).ServeHTTP(w, r) + http.FileServer(http.FS(staticFileDir)).ServeHTTP(w, r) return } diff --git a/cmd/http/public/index.html b/cmd/http/public/index.html index 674a0ad..d70545e 100644 --- a/cmd/http/public/index.html +++ b/cmd/http/public/index.html @@ -5,8 +5,8 @@

Moolah2 Hub

diff --git a/cmd/http/public/transactions.html b/cmd/http/public/transactions.html index 7cc9d89..88e3ad0 100644 --- a/cmd/http/public/transactions.html +++ b/cmd/http/public/transactions.html @@ -17,7 +17,7 @@ } function callback(responseBody, responseStatus) { } - var f = String(window.location).split("/transactions.html")[1] + var f = String(window.location).split("/public/transactions.html")[1] if (!f) { f = "/moolah.dat" }