diff options
Diffstat (limited to 'routes/users.js')
| -rw-r--r-- | routes/users.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/routes/users.js b/routes/users.js index c5ff938a..68e59b24 100644 --- a/routes/users.js +++ b/routes/users.js @@ -28,7 +28,8 @@ export default { try { user.balance = await g(`balance:${user.id}`); user.prompt = !!user.prompt; - if (user.pubkey) user.npub = encode("npub", toWords(Buffer.from(user.pubkey, "hex"))); + if (user.pubkey) + user.npub = encode("npub", toWords(Buffer.from(user.pubkey, "hex"))); res.send(pick(user, whitelist)); } catch (e) { console.log("problem fetching user", e); @@ -56,7 +57,7 @@ export default { username: key, display: key.substr(0, 6), pubkey: key, - anon: true + anon: true, }; } @@ -73,10 +74,11 @@ export default { "pubkey", "display", "prompt", - "id" + "id", ]; - if (user.pubkey) user.npub = encode("npub", toWords(Buffer.from(user.pubkey, "hex"))); + if (user.pubkey) + user.npub = encode("npub", toWords(Buffer.from(user.pubkey, "hex"))); user.prompt = !!user.prompt; res.send(pick(user, whitelist)); @@ -96,7 +98,7 @@ export default { pubkey, password, username, - salt + salt, }; user = await register(user, ip, false); @@ -172,7 +174,7 @@ export default { "salt", "seed", "tokens", - "twofa" + "twofa", ]; for (let a of attributes) { @@ -212,7 +214,7 @@ export default { if (!token) fail(); user = await got(`${classic}/admin/migrate/${username}?zero=true`, { - headers: { authorization: `Bearer ${config.admin}` } + headers: { authorization: `Bearer ${config.admin}` }, }).json(); let { balance } = user; @@ -224,7 +226,7 @@ export default { ...pick(user, fields), id: uid, about: user.address, - migrated: true + migrated: true, }; await s(`user:${username}`, uid); @@ -232,7 +234,7 @@ export default { await s(`balance:${uid}`, balance); let payments = await got(`${classic}/payments`, { - headers: { authorization: `Bearer ${token}` } + headers: { authorization: `Bearer ${token}` }, }).json(); for (let p of payments) { @@ -242,7 +244,7 @@ export default { "confirmed", "rate", "currency", - "preimage" + "preimage", ]); n.id = v4(); n.created = parseISO(p.createdAt).getTime(); @@ -260,7 +262,7 @@ export default { u = await got( `${classic}/admin/migrate/${p.with.username.toLowerCase()}`, { - headers: { authorization: `Bearer ${config.admin}` } + headers: { authorization: `Bearer ${config.admin}` }, } ).json(); @@ -332,7 +334,7 @@ export default { if (!subscriptions) subscriptions = []; if ( !subscriptions.find( - s => JSON.stringify(s) === JSON.stringify(subscription) + (s) => JSON.stringify(s) === JSON.stringify(subscription) ) ) subscriptions.push(subscription); @@ -369,8 +371,8 @@ export default { let contacts = (await g(`${id}:contacts`)) || []; for (let { ref } of ( - await Promise.all(payments.map(async id => await g(`payment:${id}`))) - ).filter(p => p.type === types.internal && p.ref)) { + await Promise.all(payments.map(async (id) => await g(`payment:${id}`))) + ).filter((p) => p.type === types.internal && p.ref)) { !~contacts.findIndex(({ id }) => id === ref) && contacts.push(await g(`user:${ref}`)); } @@ -407,5 +409,5 @@ export default { } res.send("ok"); - } + }, }; |
