diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.ts | 21 | ||||
| -rw-r--r-- | lib/whitelist.ts | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/utils.ts b/lib/utils.ts index 7fc1f4e7..278a2c82 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -71,14 +71,33 @@ export const fields = [ ]; export const getUser = async (username) => { + let update; if (username === "undefined") fail("invalid user"); const user = await migrate(username); if (user && !user.anon && !user.nwc) { user.nwc = bytesToHex(randomBytes(32)); await s(getPublicKey(user.nwc), user.id); - await s(`user:${user.id}`, user); + update = true; } + if (user.profile) { + user.picture = `https://coinos.io/api/public/${user.profile}.webp`; + delete user.profile; + + if (user.banner) { + user.banner = `https://coinos.io/api/public/${user.banner}.webp`; + } + update = true; + } + + if (user.address) { + user.about = user.address; + delete user.address; + update = true; + } + + if (update) s(`user:${user.id}`, user); + return user; }; diff --git a/lib/whitelist.ts b/lib/whitelist.ts index 285afe8a..16594a4b 100644 --- a/lib/whitelist.ts +++ b/lib/whitelist.ts @@ -1,5 +1,4 @@ export default [ - "address", "admin", "anon", "autowithdraw", |
