wip
This commit is contained in:
@@ -27,10 +27,12 @@ import (
|
|||||||
|
|
||||||
//go:embed public/*
|
//go:embed public/*
|
||||||
var _staticFileDir embed.FS
|
var _staticFileDir embed.FS
|
||||||
var staticFileDir = func() embed.FS {
|
var publicHandler = func() http.Handler {
|
||||||
panic("if dev mode then return live")
|
if os.Getenv("DEBUG") != "" {
|
||||||
return _staticFileDir
|
return http.FileServer(http.Dir("./http"))
|
||||||
}
|
}
|
||||||
|
return http.FileServer(http.FS(_staticFileDir))
|
||||||
|
}()
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
foo := flag.String("foo", "bal", "bal or reg")
|
foo := flag.String("foo", "bal", "bal or reg")
|
||||||
@@ -65,7 +67,7 @@ func Main() {
|
|||||||
if *httpOutput != "" {
|
if *httpOutput != "" {
|
||||||
foo := func(w http.ResponseWriter, r *http.Request) {
|
foo := func(w http.ResponseWriter, r *http.Request) {
|
||||||
if !strings.HasPrefix(r.URL.Path, "/api") {
|
if !strings.HasPrefix(r.URL.Path, "/api") {
|
||||||
http.FileServer(http.FS(staticFileDir)).ServeHTTP(w, r)
|
publicHandler.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
var d = JSON.parse(body)
|
var d = JSON.parse(body)
|
||||||
loadBalances(d.balances)
|
loadBalances(d.balances)
|
||||||
loadDeltas(d.deltas)
|
loadDeltas(d.deltas)
|
||||||
|
loadLastNLines(d.lastNLines)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function loadBalances(balances) {
|
function loadBalances(balances) {
|
||||||
@@ -68,6 +69,14 @@
|
|||||||
result += `</table>`
|
result += `</table>`
|
||||||
document.getElementById("reg").innerHTML = result
|
document.getElementById("reg").innerHTML = result
|
||||||
}
|
}
|
||||||
|
function loadLastNLines(lastNLines) {
|
||||||
|
var result = `<textarea>`
|
||||||
|
for (var k in lastNLines) {
|
||||||
|
result += lastNLines[k] + "\n"
|
||||||
|
}
|
||||||
|
result += `</textarea>`
|
||||||
|
document.getElementById("lastNLines").innerHTML = result
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</header>
|
</header>
|
||||||
<body onload="init();" style="min-width: 1024px;">
|
<body onload="init();" style="min-width: 1024px;">
|
||||||
@@ -81,7 +90,12 @@
|
|||||||
<iframe style="background: white; width: 100%;" src="/api/reg?x=y&mode=reg&likeName=Withdrawal:[0123]&chart=stack&predictionMonths=6&prediction=autoContributions=&bpi=true&zoomStart=YYYY-MM"></iframe>
|
<iframe style="background: white; width: 100%;" src="/api/reg?x=y&mode=reg&likeName=Withdrawal:[0123]&chart=stack&predictionMonths=6&prediction=autoContributions=&bpi=true&zoomStart=YYYY-MM"></iframe>
|
||||||
</details>
|
</details>
|
||||||
</details>
|
</details>
|
||||||
<details open>
|
<details>
|
||||||
|
<summary>Edit</summary>
|
||||||
|
<div id="lastNLines">
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
<summary>Register</summary>
|
<summary>Register</summary>
|
||||||
<div id="reg">
|
<div id="reg">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user