Add profile photo uploads and custom difficulty support

This commit is contained in:
2026-10-13 20:50:54 +05:00
parent 8c3de302e7
commit de812453ec
37 changed files with 1139 additions and 74 deletions

View File

@@ -171,6 +171,35 @@ export const difficulties = {
hard: { seconds: 30, zoom: false, label: "Hard" },
} as const;
export type Difficulty = keyof typeof difficulties;
export type DifficultyPreset = {
id: string;
name: string;
seconds: number;
zoom: boolean;
};
export const customDifficultySchema = z
.object({
name: z
.string()
.trim()
.min(2)
.max(40)
.refine(
(name) =>
!/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(
name,
),
"Difficulty names cannot contain hidden controls",
),
seconds: z
.number()
.int()
.min(15)
.max(600)
.refine((seconds) => seconds % 15 === 0),
zoom: z.boolean(),
})
.strict();
export function scoreGuess(
a: Pick<Point, "x" | "z">,
b: Pick<Point, "x" | "z">,