Add moderator bots and editable MineGeo usernames
All checks were successful
Deploy MineGeo to Dokploy / deploy (push) Successful in 3m27s

This commit is contained in:
2026-10-29 16:32:55 +05:00
parent 658c8974ac
commit 50b27cf498
19 changed files with 654 additions and 10 deletions

View File

@@ -256,10 +256,10 @@ export async function accountApi(
{ error: "Earn a username glow before choosing its color" },
403,
);
const profile = required(
await admin()
const updatedProfile = await admin()
.from("profiles")
.update({
...(body.username !== undefined ? { username: body.username } : {}),
...(body.displayName !== undefined
? { display_name: body.displayName }
: {}),
@@ -272,10 +272,11 @@ export async function accountApi(
})
.eq("id", account.id)
.select(
"id,display_name,avatar_path,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon",
"id,username,display_name,avatar_path,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon",
)
.single(),
);
.single();
if (updatedProfile.error?.code === "23505") return json({ error: "That username is already taken." }, 409);
const profile = required(updatedProfile);
if (
body.avatarPath !== undefined &&
body.avatarPath !== current.avatar_path

View File

@@ -21,7 +21,7 @@ export async function accountProfile(account: User) {
await admin()
.from("profiles")
.select(
"id,display_name,avatar_path,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon,account_status,account_reason,account_changed_at",
"id,username,display_name,avatar_path,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon,account_status,account_reason,account_changed_at",
)
.eq("id", account.id)
.single(),