From 14d870dec052c4ae279933983d56ab6a0149bc1e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 16 Dec 2021 17:31:18 -0800 Subject: handle taproot address index --- routes/payments.js | 2 +- routes/users.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/routes/payments.js b/routes/payments.js index ac9cff5c..9cc692db 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -59,7 +59,7 @@ if (config.bitcoin) { const address = await bc.getNewAddress(); const { hdkeypath } = await bc.getAddressInfo(address); const parts = hdkeypath.split("/"); - app.set("bcAddressIndex", parts[parts.length - 1].slice(0, -1)); + app.set("bcAddressIndex", parts[parts.length - 1].replace("'", "")); } catch (e) { console.error(e); } diff --git a/routes/users.js b/routes/users.js index 7ea91413..df42d82d 100644 --- a/routes/users.js +++ b/routes/users.js @@ -27,6 +27,14 @@ const twofa = ah((req, res, next) => { } else next(); }); +app.get( + "/me", + auth, + ah(async (req, res) => { + res.send(req.user); + }) +); + app.get( "/users/:username", ah(async (req, res) => { @@ -785,7 +793,7 @@ app.post( if (config.bitcoin.walletpass) await bc.walletPassphrase(config.bitcoin.walletpass, 300); return res.send(await bc.signMessage(address, message)); - } + } res.status(500).send("Address not found for user"); }) -- cgit v1.2.3