diff options
| author | Adam Soltys <[email protected]> | 2025-07-10 12:25:09 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-10 12:37:05 -0700 |
| commit | 81a7608330f3cb3eae513429b61a8611267547a3 (patch) | |
| tree | 92dbf3955cddaa5bedf492bbb63593fb8b298cc0 | |
| parent | 9e6d7773f2b7de51d09aa8203ecdc854ef8f076f (diff) | |
| download | coinos-server-81a7608330f3cb3eae513429b61a8611267547a3.tar.gz coinos-server-81a7608330f3cb3eae513429b61a8611267547a3.zip | |
fresh attribute
| -rw-r--r-- | lib/register.ts | 2 | ||||
| -rw-r--r-- | lib/whitelist.ts | 1 | ||||
| -rw-r--r-- | routes/users.ts | 7 |
3 files changed, 8 insertions, 2 deletions
diff --git a/lib/register.ts b/lib/register.ts index 107be6ea..0db5dfd0 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -85,6 +85,8 @@ export default async (user, ip) => { await s(`app:${app.pubkey}`, app); await db.sAdd(`${id}:apps`, app.pubkey); + console.log("USER", user); + db.multi() .set(`user:${id}`, JSON.stringify(user)) .set(`user:${username}`, id) diff --git a/lib/whitelist.ts b/lib/whitelist.ts index ca0431f5..53fd231f 100644 --- a/lib/whitelist.ts +++ b/lib/whitelist.ts @@ -11,6 +11,7 @@ export default [ "display", "email", "fiat", + "fresh", "followers", "follows", "haspin", diff --git a/routes/users.ts b/routes/users.ts index c35d4b55..34c2a655 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -126,8 +126,8 @@ export default { const ip = headers["cf-connecting-ip"]; if (!body.user) fail("no user object provided"); let { user } = body; - const fields = ["pubkey", "password", "username", "picture"]; + const fields = ["pubkey", "password", "username", "picture", "fresh"]; user = await register(pick(user, fields), ip); const payload = { id: user.id }; @@ -206,7 +206,9 @@ export default { if (pubkey) { pubkey = pubkey.trim(); exists = await getUser(pubkey); - let existingUsername = exists?.username?.toLowerCase().replace(/\s/g,""); + const existingUsername = exists?.username + ?.toLowerCase() + .replace(/\s/g, ""); if (exists && username !== existingUsername) { warn("key in use", pubkey, existingUsername); if (exists.anon) await db.del(`user:${pubkey}`); @@ -283,6 +285,7 @@ export default { if (typeof body[a] !== "undefined") user[a] = body[a]; } + user.fresh = false; user.tip = Math.max(0, Math.min(1000, parseInt(user.tip))); if (password && password === confirm) { |
