diff options
Diffstat (limited to 'routes/info.ts')
| -rw-r--r-- | routes/info.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/routes/info.ts b/routes/info.ts index c6d03e4d..4ab11872 100644 --- a/routes/info.ts +++ b/routes/info.ts @@ -1,9 +1,15 @@ import { archive } from "$lib/db"; -import { db, g } from "$lib/db"; +import { db } from "$lib/db"; +import { getHealthStatus } from "$lib/health"; import ln from "$lib/ln"; -import { getDecodedToken } from "@cashu/cashu-ts"; export default { + async health(_, res) { + const status = getHealthStatus(); + const httpStatus = status.healthy ? 200 : 503; + res.status(httpStatus).send(status); + }, + async balances(_, res) { let total = 0; @@ -21,13 +27,7 @@ export default { ); const lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0)); - const cash = getDecodedToken(await g("cash")).proofs.reduce( - (a, b) => a + b.amount, - 0, - ); - const info = { - cash, lnchannel, lnwallet, }; |
