Release v0.1.4 with terrain rescanning and owner-published map updates
All checks were successful
Deploy MineGeo to Dokploy / deploy (push) Successful in 6m26s

This commit is contained in:
2026-10-28 19:40:53 +05:00
parent 5898ef35a5
commit 658c8974ac
53 changed files with 608 additions and 83 deletions

View File

@@ -193,12 +193,14 @@ export async function handle(request: NextRequest, path: string[]) {
.order("name", { ascending: true }),
);
return NextResponse.json({
presets: presets.map(({ map_zoom, map_pan, timer_visible, ...preset }) => ({
...preset,
mapZoom: map_zoom,
mapPan: map_pan,
timerVisible: timer_visible,
})),
presets: presets.map(
({ map_zoom, map_pan, timer_visible, ...preset }) => ({
...preset,
mapZoom: map_zoom,
mapPan: map_pan,
timerVisible: timer_visible,
}),
),
});
}
if (method === "POST") {
@@ -210,14 +212,26 @@ export async function handle(request: NextRequest, path: string[]) {
const { mapZoom, mapPan, timerVisible, ...fields } = body;
const { data, error } = await client
.from("difficulty_presets")
.insert({ ...fields, map_zoom: mapZoom, map_pan: mapPan, timer_visible: timerVisible })
.insert({
...fields,
map_zoom: mapZoom,
map_pan: mapPan,
timer_visible: timerVisible,
})
.select(
"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, mapPan: data.map_pan, timerVisible: data.timer_visible } : null,
preset: data
? {
...data,
mapZoom: data.map_zoom,
mapPan: data.map_pan,
timerVisible: data.timer_visible,
}
: null,
});
}
}
@@ -249,7 +263,10 @@ export async function handle(request: NextRequest, path: string[]) {
const body = z
.object({
datasetId: idSchema,
difficulty: z.union([z.enum(["easy", "normal", "hard", "void"]), idSchema]),
difficulty: z.union([
z.enum(["easy", "normal", "hard", "void"]),
idSchema,
]),
})
.parse(await jsonBody(request));
const secret = cookieSecret(request) || randomBytes(32).toString("hex");
@@ -668,9 +685,22 @@ export async function handle(request: NextRequest, path: string[]) {
.eq("dataset_id", d.id)
.maybeSingle();
checkServiceError(jobResult.error);
const parent = d.parent_dataset_id
? required(
await client
.from("datasets")
.select("owner_id,state,update_state")
.eq("id", d.parent_dataset_id)
.single(),
)
: null;
if (needsProcessing(jobResult.data)) processUploadAfterResponse(d.id);
return NextResponse.json({
...d,
ownsPublishedParent:
!!parent &&
parent.owner_id === d.owner_id &&
parent.state === "published",
upload_jobs: jobResult.data,
name: manifest.name,
description: manifest.description,
@@ -696,7 +726,7 @@ export async function handle(request: NextRequest, path: string[]) {
allowContributions: z.boolean().optional(),
contributionServerAddress: z
.string()
.max(255)
.max(2559)
.nullable()
.optional(),
})
@@ -738,6 +768,34 @@ export async function handle(request: NextRequest, path: string[]) {
checkServiceError(error);
return NextResponse.json({ ok: true });
}
if (method === "POST" && path[2] === "publish-own-contribution") {
const owner = await contributor(request, true);
if (owner !== d.owner_id)
throw new ServiceError("Map owner permission required", 403);
checkServiceError(
(
await client.rpc("publish_own_contribution", {
p_contribution: d.id,
p_owner: owner,
})
).error,
);
return NextResponse.json({ ok: true });
}
if (method === "POST" && path[2] === "publish-update") {
const owner = await contributor(request, true);
if (owner !== d.owner_id)
throw new ServiceError("Map owner permission required", 403);
checkServiceError(
(
await client.rpc("publish_owner_update", {
p_dataset: d.id,
p_owner: owner,
})
).error,
);
return NextResponse.json({ ok: true });
}
if (method === "POST" && path[2] === "submit") {
if (d.imported_from_id)
throw new ServiceError(