landing: compact GOA alt display and all-account bank fallback
Wire goa-amount.js into bank/exchange/merchant intros, deploy it with the landings, and deepen the in-container bank stats fallback to scan all accounts (skip only exchange) when the host timer is down.
This commit is contained in:
parent
746d7a41af
commit
48f77139c5
8 changed files with 363 additions and 39 deletions
|
|
@ -103,11 +103,31 @@ taler-wallet-cli exchanges accept-tos https://exchange.hacktivism.ch/
|
|||
|
||||
---
|
||||
|
||||
## Live stats (in bank container)
|
||||
## Live stats (central host collector · hernani systemd)
|
||||
|
||||
Stats are **not** computed on the laptop or host browser. A small script runs
|
||||
**inside the bank container**, queries libeufin for the demo funding account
|
||||
(`explorer`), and writes a public JSON file next to the landing assets.
|
||||
**Primary:** user **hernani** on koopa runs `taler-landing-stats.timer`
|
||||
(`scripts/taler-landing/`). That process full-scans **all bank accounts**
|
||||
(except `exchange` double-count), paginates every ledger, writes
|
||||
`stats.json` with **GOA alt units** (`amount_alt` / Kilo-GOA / Mega-GOA / …),
|
||||
and refreshes exchange + merchant stats the same way.
|
||||
|
||||
```bash
|
||||
# on koopa as hernani
|
||||
./scripts/taler-landing/install-landing-stats-host.sh
|
||||
sudo loginctl enable-linger hernani
|
||||
systemctl --user start taler-landing-stats.service
|
||||
```
|
||||
|
||||
See **`scripts/taler-landing/README.md`**.
|
||||
|
||||
**Fallback:** in-container `landing-stats.sh` (below) if the host timer is down.
|
||||
It now also scans admin + all users (skips only `exchange`).
|
||||
|
||||
## Live stats (in bank container · fallback)
|
||||
|
||||
Stats are **not** computed in the browser. A small script can still run
|
||||
**inside the bank container**, query libeufin (all accounts), and write a
|
||||
public JSON file next to the landing assets.
|
||||
|
||||
| Piece | Path / role |
|
||||
|-------|-------------|
|
||||
|
|
@ -131,9 +151,9 @@ Stats are **not** computed on the laptop or host browser. A small script runs
|
|||
|
||||
| Env | Default | Meaning |
|
||||
|-----|---------|---------|
|
||||
| `TX_DELTA` | `-50000` | per-account ledger window (`GET …/transactions?delta=`) |
|
||||
| `ACCOUNTS_DELTA` | `-500` | account-list window (`GET /accounts?delta=`) |
|
||||
| `MAX_SCAN_ACCOUNTS` | `500` | max usernames to scan |
|
||||
| `TX_DELTA` | `-200000` | per-account ledger window (`GET …/transactions?delta=`) |
|
||||
| `ACCOUNTS_DELTA` | `-10000` | account-list window (`GET /accounts?delta=`) |
|
||||
| `MAX_SCAN_ACCOUNTS` | `0` (unlimited) | max usernames to scan; `0` = all |
|
||||
|
||||
Older defaults (`TX_DELTA=-100`, `MAX_SCAN_ACCOUNTS=80`) **undercounted** credits/withdraws
|
||||
and account totals on this stack. Empty accounts often return **HTTP 204** (no body) —
|
||||
|
|
|
|||
|
|
@ -1491,6 +1491,7 @@ tw run-until-done && tw balance</pre>
|
|||
</footer>
|
||||
</main>
|
||||
|
||||
<script src="/intro/goa-amount.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var WEBUI = "https://bank.hacktivism.ch/webui/";
|
||||
|
|
@ -1936,16 +1937,34 @@ tw run-until-done && tw balance</pre>
|
|||
var el = document.getElementById(id);
|
||||
if (el) el.textContent = v == null || v === "" ? "—" : String(v);
|
||||
}
|
||||
function setAmt(id, rowOrAmt) {
|
||||
var el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
if (window.GoaAmount) {
|
||||
var f = GoaAmount.pick(rowOrAmt, d.alt_unit_names);
|
||||
el.textContent = f.display;
|
||||
if (f.title && f.title !== f.display) el.setAttribute("title", f.title);
|
||||
else el.removeAttribute("title");
|
||||
} else {
|
||||
var raw = rowOrAmt && typeof rowOrAmt === "object"
|
||||
? (rowOrAmt.amount_alt || rowOrAmt.amount || rowOrAmt.total_amount || "—")
|
||||
: (rowOrAmt == null || rowOrAmt === "" ? "—" : String(rowOrAmt));
|
||||
el.textContent = raw;
|
||||
}
|
||||
}
|
||||
if (window.GoaAmount) GoaAmount.rememberAlt(d);
|
||||
var flow = d.flow || {};
|
||||
var fin = flow.incoming || {};
|
||||
var fwd = flow.withdraw || {};
|
||||
set("st-accounts", ba.total != null ? ba.total : "—");
|
||||
set("st-wallets", wl.unique_reserves != null ? wl.unique_reserves : "—");
|
||||
set("st-incoming", fin.amount || flow.total_in || "—");
|
||||
set("st-withdraw", fwd.amount || w.total_amount || "—");
|
||||
set("st-24h", h24.amount || "GOA:0");
|
||||
set("st-7d", h7.amount || "GOA:0");
|
||||
set("shared-balance", d.balance_explorer || "—");
|
||||
setAmt("st-incoming", fin.amount_alt ? fin : (fin.amount || flow.total_in || "—"));
|
||||
setAmt("st-withdraw", fwd.amount_alt ? fwd : (fwd.amount || w.total_amount || "—"));
|
||||
setAmt("st-24h", h24.amount_alt ? h24 : (h24.amount || "GOA:0"));
|
||||
setAmt("st-7d", h7.amount_alt ? h7 : (h7.amount || "GOA:0"));
|
||||
setAmt("shared-balance", d.balance_explorer_alt
|
||||
? { amount: d.balance_explorer, amount_alt: d.balance_explorer_alt, amount_full: d.balance_explorer_full }
|
||||
: (d.balance_explorer || "—"));
|
||||
|
||||
var list = document.getElementById("st-recent");
|
||||
if (list) {
|
||||
|
|
@ -1962,7 +1981,13 @@ tw run-until-done && tw balance</pre>
|
|||
var li = document.createElement("li");
|
||||
var amt = document.createElement("span");
|
||||
amt.className = "amt";
|
||||
amt.textContent = row.amount || "?";
|
||||
if (window.GoaAmount) {
|
||||
var af = GoaAmount.pick(row, d.alt_unit_names);
|
||||
amt.textContent = af.display;
|
||||
if (af.title && af.title !== af.display) amt.setAttribute("title", af.title);
|
||||
} else {
|
||||
amt.textContent = row.amount_alt || row.amount || "?";
|
||||
}
|
||||
var meta = document.createElement("span");
|
||||
meta.className = "meta";
|
||||
var when = fmtCest(row.at_unix, row.at || row.at_iso) || "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue