diff options
| author | Adam Soltys <[email protected]> | 2025-07-12 22:52:01 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-12 22:52:01 -0700 |
| commit | 53a4d40f6861312a6fc6e6d99c317a0d82eda32f (patch) | |
| tree | 7c0e87c16800cd1dfc0817ab3150c7dd2e274beb | |
| parent | 34b83c88006cb0aa52551199a49fe96c2cc51186 (diff) | |
| download | coinos-server-53a4d40f6861312a6fc6e6d99c317a0d82eda32f.tar.gz coinos-server-53a4d40f6861312a6fc6e6d99c317a0d82eda32f.zip | |
check account ownership
| -rw-r--r-- | index.ts | 3 | ||||
| -rw-r--r-- | routes/payments.ts | 24 |
2 files changed, 26 insertions, 1 deletions
@@ -82,6 +82,9 @@ app.post("/replace", auth, payments.replace); app.get("/decode/:bolt11", payments.decode); app.post("/fetchinvoice", payments.fetchinvoice); +app.get("/auth", payments.auth); +app.post("/order", payments.order); + app.get("/encode", lnurl.encode); app.get("/decode", lnurl.decode); app.get("/lnurl/verify/:id", lnurl.verify); diff --git a/routes/payments.ts b/routes/payments.ts index 66a19e53..c6653f1c 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -103,6 +103,9 @@ export default { } = req; if (!aid || aid === "undefined") aid = id; + const index = await db.lPos(`${id}:accounts`, aid); + if (index === null) fail("unauthorized"); + limit = parseInt(limit); offset = parseInt(offset) || 0; @@ -271,7 +274,16 @@ export default { const managers = await db.sMembers(`fund:${id}:managers`); if (managers.length && !managers.includes(user.id)) fail("Unauthorized"); - const result: any = await db.debit(`fund:${id}`, "", "Insufficient funds", amount, 0, 0, 0, 0); + const result: any = await db.debit( + `fund:${id}`, + "", + "Insufficient funds", + amount, + 0, + 0, + 0, + 0, + ); if (result.err) fail(result.err); const rates = await g("rates"); @@ -614,4 +626,14 @@ export default { const { amount, offer } = req.body; res.send(await ln.fetchinvoice(offer, amount ? amount * 1000 : null)); }, + + async auth(req, res) { + console.log(req.query); + res.send(req.query); + }, + + async order(req, res) { + console.log(req.body); + res.send(req.body); + }, }; |
