From 0dc07d2e32a9afc5ae4728bb2c7c9b9b52059cdf Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Aug 2025 21:52:40 -0700 Subject: handle 0 tip --- lib/invoices.ts | 3 ++- routes/invoices.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/invoices.ts b/lib/invoices.ts index 48eb4879..45987ae1 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -80,9 +80,10 @@ export const generate = async ({ invoice, user }) => { r.bolt11 = bolt11; } else { expiry ||= 60 * 60 * 24 * 30; + r = await ln.invoice({ amount_msat: amount ? `${amount + tip}sat` : "any", - label: `${id} ${user.username} ${new Date()}`, + label: `${id} ${user.username} ${Date.now()}`, description: memo || "", expiry, deschashonly: true, diff --git a/routes/invoices.ts b/routes/invoices.ts index a2bab026..430c926d 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -53,7 +53,7 @@ export default { try { const { id } = req.params; const { body } = req; - if (!body.invoice?.tip || body.invoice.tip < 0) fail("Invalid tip"); + if (body.invoice?.tip == null || body.invoice.tip < 0) fail("Invalid tip"); let invoice = await g(`invoice:${id}`); const user = await g(`user:${invoice.uid}`); -- cgit v1.2.3