aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/invoices.js14
-rw-r--r--lib/webhooks.js9
-rw-r--r--routes/invoices.js5
3 files changed, 12 insertions, 16 deletions
diff --git a/lib/invoices.js b/lib/invoices.js
index ddb378cf..f64cf409 100644
--- a/lib/invoices.js
+++ b/lib/invoices.js
@@ -29,9 +29,8 @@ export let generate = async ({ invoice, user, sender, memo }) => {
let hash, text;
if (type === types.lightning) {
- let amt = amount ? `${amount + tip}sat` : "any";
let r = await ln.invoice(
- amt,
+ amount ? `${amount + tip}sat` : "any",
new Date(),
memo || "",
3600,
@@ -54,16 +53,17 @@ export let generate = async ({ invoice, user, sender, memo }) => {
}
invoice = {
- ...invoice,
amount,
- hash,
- text,
+ created: Date.now(),
currency,
+ hash,
rate,
+ received: 0,
+ request_id,
+ text,
tip,
+ type,
uid,
- received: 0,
- created: Date.now()
};
l("creating invoice", user.username, amount, tip, currency, invoice.hash);
diff --git a/lib/webhooks.js b/lib/webhooks.js
index c071eccb..1158fe9d 100644
--- a/lib/webhooks.js
+++ b/lib/webhooks.js
@@ -9,23 +9,18 @@ export const callWebhook = async (invoice, payment) => {
let { address, received, text, webhook } = invoice;
if (webhook) {
- let { amount, confirmed, hash, memo, account } = payment;
- let { asset } = account;
- let secret = config.webhooks[webhook];
+ let { amount, confirmed, hash, memo } = payment;
l("calling webhook", webhook, amount, hash, address, text);
let res = await got(webhook, {
- headers: { "x-webhook": secret },
json: {
address,
amount,
- asset,
confirmed,
hash,
memo,
received,
- text,
- webhook
+ text
}
}).res();
return res;
diff --git a/routes/invoices.js b/routes/invoices.js
index c7611f54..8e23e5f1 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -1,6 +1,7 @@
import { g, s } from "$lib/db";
import { generate } from "$lib/invoices";
-import { fail } from "$lib/utils";
+import { fail, pick } from "$lib/utils";
+import whitelist from "$lib/whitelist";
import got from "got";
import config from "$config";
import ln from "$lib/ln";
@@ -15,7 +16,7 @@ export default {
let invoice = await g(`invoice:${hash}`);
if (invoice) {
- invoice.user = await g(`user:${invoice.uid}`);
+ invoice.user = pick(await g(`user:${invoice.uid}`), whitelist);
invoice.id = hash;
} else if (config.classic) {
invoice = await got(`${config.classic}/invoice/${pr}`).json();