aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/invoices.ts4
-rw-r--r--routes/lnurl.ts4
-rw-r--r--routes/payments.ts5
3 files changed, 7 insertions, 6 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts
index 36869575..a18f4263 100644
--- a/routes/invoices.ts
+++ b/routes/invoices.ts
@@ -1,5 +1,5 @@
import config from "$config";
-import { db, g, s } from "$lib/db";
+import { db, g, gf, s } from "$lib/db";
import { generate } from "$lib/invoices";
import { err } from "$lib/logging";
import { bail, fail, fields, getInvoice, getUser } from "$lib/utils";
@@ -57,7 +57,7 @@ export default {
if (tip < 0) fail("Invalid tip");
- let invoice = await g(`invoice:${id}`);
+ let invoice = await gf(`invoice:${id}`);
const user = await g(`user:${invoice.uid}`);
if (typeof tip !== "undefined") invoice.tip = tip;
diff --git a/routes/lnurl.ts b/routes/lnurl.ts
index 729cca58..0358488e 100644
--- a/routes/lnurl.ts
+++ b/routes/lnurl.ts
@@ -1,4 +1,4 @@
-import { db, g, s } from "$lib/db";
+import { db, g, gf, s } from "$lib/db";
import { generate } from "$lib/invoices";
import { err, warn } from "$lib/logging";
import { serverPubkey2 } from "$lib/nostr";
@@ -126,7 +126,7 @@ export default {
}
const invoice = iid
- ? await g(`invoice:${iid}`)
+ ? await gf(`invoice:${iid}`)
: await generate({
invoice: {
amount: Math.round(amount / 1000),
diff --git a/routes/payments.ts b/routes/payments.ts
index a61c4c3c..a640d8e2 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -575,7 +575,8 @@ export default {
user,
} = req;
try {
- const p = await g(`payment:${id}`);
+ const p = await gf(`payment:${id}`);
+ if (!p) fail("Payment not found");
if (p.uid !== user.id) fail("unauthorized");
emit(user.id, "payment", p);
@@ -647,7 +648,7 @@ export default {
user,
} = req;
try {
- const p = await g(`payment:${id}`);
+ const p = await gf(`payment:${id}`);
if (!p) fail("Payment not found");
if (p.uid !== user.id) fail("unauthorized");