Add profile photo uploads and custom difficulty support
This commit is contained in:
@@ -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">,
|
||||
|
||||
Reference in New Issue
Block a user