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

@@ -10,6 +10,7 @@ export const displayNameSchema = z
(value) => !/[\u0000-\u001f\u007f\u202a-\u202e\u2066-\u2069]/u.test(value),
"Use a single line without hidden control characters",
);
export const usernameSchema = z.string().trim().toLowerCase().regex(/^[a-z0-9_]{3,32}$/, "Use 3–32 letters, numbers or underscores.");
export const newPasswordSchema = z
.string()
.min(12, "Use at least 12 characters")
@@ -41,6 +42,7 @@ export const authActionSchema = z.discriminatedUnion("action", [
export const profileUpdateSchema = z
.object({
displayName: displayNameSchema.optional(),
username: usernameSchema.optional(),
glowColor: glowColorSchema.optional(),
avatarPath: z.string().max(128).nullable().optional(),
})
@@ -48,6 +50,7 @@ export const profileUpdateSchema = z
.refine(
(value) =>
value.displayName !== undefined ||
value.username !== undefined ||
value.glowColor !== undefined ||
value.avatarPath !== undefined,
"Choose a profile change",
@@ -81,5 +84,6 @@ export function authDestination(value: string | null | undefined): string {
if (value && /^\/support\/[0-9a-f-]{36}$/i.test(value)) return value;
if (value && /^\/tournaments\?map=[0-9a-f-]{36}$/i.test(value)) return value;
if (value && /^\/pair\?code=[A-F0-9]{8}$/.test(value)) return value;
if (value && /^\/moderator-application\/[a-f0-9]{64}$/.test(value)) return value;
return "/dashboard";
}