embed static files
cicd / cicd (push) Successful in 44s Details

main
bel 2023-10-28 10:38:28 -06:00
parent cb6e23a498
commit 432b2df131
3 changed files with 10 additions and 4 deletions

View File

@ -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
}

View File

@ -5,8 +5,8 @@
<body style="height: 100%;">
<h1>Moolah2 Hub</h1>
<ul style="line-height: 3em;">
<li><a href="/transactions.html">Transactions on Shared Chase</a></li>
<li><a href="/explore.html">Explore Bel's Money</a></li>
<li><a href="/public/transactions.html">Transactions on Shared Chase</a></li>
<li><a href="/public/explore.html">Explore Bel's Money</a></li>
<li><a href="/api/bal?x=y&mode=bal&likeName=AssetAccount&chart=stack&predictionMonths=120&bpi=true&zoomStart=2023-06&prediction=interest=AssetAccount:Cash%20\$%200.02&prediction=contributions=AssetAccount:Bonds%20$%201875&prediction=interest=AssetAccount:Monthly%20\$%200.03&prediction=contributions=AssetAccount:Monthly%20$%202500&predictFixedGrowth=VBTLX=0.02&predictFixedGrowth=GLD=0.02&predictFixedGrowth=FXAIX=0.03&predictFixedGrowth=FSPSX=0.03&whatIf=AssetAccount:Cash%20$%20-.10000&=">Project Bel's Net Worth</a></li>
<li><a href="/api/reg?x=y&mode=reg&likeName=Withdrawal:&chart=stack&predictionMonths=3&bpi=false&zoomStart=2023-01&prediction=autoContributions=&predictFixedGrowth=VBTLX=0&whatIf=AssetAccount:Cash%20$%20-.10000&=">Expect Bel's Expenses</a></li>
</ul>

View File

@ -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"
}