Add Void difficulty and publish changelogs
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m40s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m40s
This commit is contained in:
16
lib/api.ts
16
lib/api.ts
@@ -188,14 +188,16 @@ export async function handle(request: NextRequest, path: string[]) {
|
||||
await client
|
||||
.from("difficulty_presets")
|
||||
.select(
|
||||
"id,name,seconds,zoom,pan,compass,coordinates,map_zoom,scoring",
|
||||
"id,name,seconds,zoom,pan,compass,coordinates,map_zoom,map_pan,timer_visible,scoring",
|
||||
)
|
||||
.order("name", { ascending: true }),
|
||||
);
|
||||
return NextResponse.json({
|
||||
presets: presets.map(({ map_zoom, ...preset }) => ({
|
||||
presets: presets.map(({ map_zoom, map_pan, timer_visible, ...preset }) => ({
|
||||
...preset,
|
||||
mapZoom: map_zoom,
|
||||
mapPan: map_pan,
|
||||
timerVisible: timer_visible,
|
||||
})),
|
||||
});
|
||||
}
|
||||
@@ -205,17 +207,17 @@ export async function handle(request: NextRequest, path: string[]) {
|
||||
request.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ||
|
||||
"unknown";
|
||||
await limit("difficulty-presets:" + hash(address), 8, 3600);
|
||||
const { mapZoom, ...fields } = body;
|
||||
const { mapZoom, mapPan, timerVisible, ...fields } = body;
|
||||
const { data, error } = await client
|
||||
.from("difficulty_presets")
|
||||
.insert({ ...fields, map_zoom: mapZoom })
|
||||
.insert({ ...fields, map_zoom: mapZoom, map_pan: mapPan, timer_visible: timerVisible })
|
||||
.select(
|
||||
"id,name,seconds,zoom,pan,compass,coordinates,map_zoom,scoring",
|
||||
"id,name,seconds,zoom,pan,compass,coordinates,map_zoom,map_pan,timer_visible,scoring",
|
||||
)
|
||||
.single();
|
||||
checkDifficultyPresetError(error);
|
||||
return NextResponse.json({
|
||||
preset: data ? { ...data, mapZoom: data.map_zoom } : null,
|
||||
preset: data ? { ...data, mapZoom: data.map_zoom, mapPan: data.map_pan, timerVisible: data.timer_visible } : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -247,7 +249,7 @@ export async function handle(request: NextRequest, path: string[]) {
|
||||
const body = z
|
||||
.object({
|
||||
datasetId: idSchema,
|
||||
difficulty: z.union([z.enum(["easy", "normal", "hard"]), idSchema]),
|
||||
difficulty: z.union([z.enum(["easy", "normal", "hard", "void"]), idSchema]),
|
||||
})
|
||||
.parse(await jsonBody(request));
|
||||
const secret = cookieSecret(request) || randomBytes(32).toString("hex");
|
||||
|
||||
Reference in New Issue
Block a user