diff options
| author | Adam Soltys <[email protected]> | 2023-04-16 18:14:36 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-04-16 18:16:59 +0000 |
| commit | e1beafc2c1add04495fe31475aa344c5219e525c (patch) | |
| tree | e76df5d71c5fa16d3a17a40ec384ed0f275159ea /routes | |
| parent | d404f11e5df3c982ed91e4cddd2fbc9de6870262 (diff) | |
| download | coinos-server-e1beafc2c1add04495fe31475aa344c5219e525c.tar.gz coinos-server-e1beafc2c1add04495fe31475aa344c5219e525c.zip | |
ip and lnurl fixes
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/lnurl.js | 1 | ||||
| -rw-r--r-- | routes/users.js | 18 |
2 files changed, 3 insertions, 16 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js index bcb3f234..5cfb26bb 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -92,6 +92,7 @@ export default { let uid = await g(`lnurl:${id}`); let user = await g(`user:${uid}`); let { username } = user; + username = username.replace(/\s/g, '').toLowerCase(); let metadata = JSON.stringify([ ["text/plain", `Paying ${username}@${host}`], diff --git a/routes/users.js b/routes/users.js index e82a6772..70dce4d5 100644 --- a/routes/users.js +++ b/routes/users.js @@ -125,7 +125,7 @@ export default { async create(req, res) { try { - const ip = req.headers["x-forwarded-for"] || req.socket.remoteAddress; + const ip = req.headers["cf-connecting-ip"] || req.socket.remoteAddress; let { cipher, pubkey, password, username, salt } = req.body.user; let user = { @@ -443,21 +443,7 @@ export default { }, async fix(req, res) { - if (!req.user.admin) fail("unauthorized"); - let uid = await g("user:laughingbean"); - let payments = await db.lRange(`${uid}:payments`, 0, -1); - - for (let hash of payments) { - let payment = await g(`payment:${hash}`); - let invoice = await g(`invoice:${hash}`); - if (!invoice) continue; - if (invoice.amount !== payment.amount) { - payment.amount -= payment.tip; - s(`payment:${hash}`, payment); - } - } - - res.send("ok"); + res.send(req.headers); }, async reset({ body: { username, password }, user: { admin } }, res) { |
