diff options
| -rw-r--r-- | routes/nostr.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/routes/nostr.ts b/routes/nostr.ts index f1b6a585..0cf4a95e 100644 --- a/routes/nostr.ts +++ b/routes/nostr.ts @@ -266,19 +266,19 @@ export default { async zap(req, res) { try { - const { event } = req.body; - const amount = event.tags.find((t) => t[0] === "amount")[1]; - const pubkey = event.tags.find((t) => t[0] === "p")[1]; - const content = JSON.stringify(await getProfile(pubkey)); - const callback = await getZapEndpoint({ content } as Event); - const url = new URL(callback); - url.searchParams.set("amount", (amount * 1000).toString()); - url.searchParams.set("nostr", JSON.stringify(event)); + const { event } = req.body; + const amount = event.tags.find((t) => t[0] === "amount")[1]; + const pubkey = event.tags.find((t) => t[0] === "p")[1]; + const content = JSON.stringify(await getProfile(pubkey)); + const callback = await getZapEndpoint({ content } as Event); + const url = new URL(callback); + url.searchParams.set("amount", (amount * 1000).toString()); + url.searchParams.set("nostr", JSON.stringify(event)); console.log("URL", url.toString()); - const json = await got(url.toString()).json(); + const json = await got(url.toString()).json(); - res.send(json); - } catch(e) { + res.send(json); + } catch (e) { console.log(e); bail(res, e.message); } |
