diff options
| author | Adam Soltys <[email protected]> | 2024-10-31 09:29:04 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-31 09:34:42 -0700 |
| commit | aa4cd39c943b67169def224e224bd07b815b70ec (patch) | |
| tree | 2af857ac971705f4d20eb017864f0365d0b57ea6 /lib/register.ts | |
| parent | bc9c04f6519f32d3b444d4df0b276eba960480a9 (diff) | |
| download | coinos-server-aa4cd39c943b67169def224e224bd07b815b70ec.tar.gz coinos-server-aa4cd39c943b67169def224e224bd07b815b70ec.zip | |
biome lint
Diffstat (limited to 'lib/register.ts')
| -rw-r--r-- | lib/register.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/register.ts b/lib/register.ts index c2677c30..139aefcf 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -8,7 +8,7 @@ import { db } from "$lib/db"; import { l, warn } from "$lib/logging"; import { fail, getUser } from "$lib/utils"; -let valid = /^[\p{L}\p{N}]{2,24}$/u; +const valid = /^[\p{L}\p{N}]{2,24}$/u; export default async (user, ip) => { let { password, pubkey, username } = user; l("registering", username); @@ -18,10 +18,10 @@ export default async (user, ip) => { if (!valid.test(username)) fail("Usernames can only have letters and numbers"); - let id = v4(); + const id = v4(); user.id = id; - let exists = await getUser(username); + const exists = await getUser(username); if (exists) fail(`Username ${username} taken`); if (password) { @@ -34,7 +34,7 @@ export default async (user, ip) => { user.currency = "USD"; if (config.ipregistry) { try { - let { + const { location: { country: { code } }, }: any = await got( `https://api.ipregistry.co/${ip}?key=${config.ipregistry}&fields=location.country.code`, @@ -52,7 +52,7 @@ export default async (user, ip) => { user.migrated = true; user.locktime = 300; - let account = JSON.stringify({ + const account = JSON.stringify({ id, type: "ecash", name: "Spending", @@ -66,7 +66,7 @@ export default async (user, ip) => { .set(`account:${id}`, account) .set(`${pubkey}:follows:n`, 0) .set(`${pubkey}:followers:n`, 0) - .set(`${pubkey}:pubkeys`, "[]") + .set(`${pubkey}:pubkeys`, "[]") .lPush(`${id}:accounts`, id) .exec(); |
