aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-10 12:25:09 -0700
committerAdam Soltys <[email protected]>2025-07-10 12:37:05 -0700
commit81a7608330f3cb3eae513429b61a8611267547a3 (patch)
tree92dbf3955cddaa5bedf492bbb63593fb8b298cc0 /routes
parent9e6d7773f2b7de51d09aa8203ecdc854ef8f076f (diff)
downloadcoinos-server-81a7608330f3cb3eae513429b61a8611267547a3.tar.gz
coinos-server-81a7608330f3cb3eae513429b61a8611267547a3.zip
fresh attribute
Diffstat (limited to 'routes')
-rw-r--r--routes/users.ts7
1 files changed, 5 insertions, 2 deletions
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) {