Reopen advanced edits from their saved recipe, seed or take over the quick editor from them, refresh thumbnails after a save, and add an edited-only download. Also fixes the Lumenroom library collapsing to slivers on large shoots and documents deploying both containers on a new host. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -10,6 +10,17 @@ import { mediaStorage } from "@/lib/media-storage";
|
||||
import { eventPhotoPath } from "@/lib/event-photos";
|
||||
import sharp from "sharp";
|
||||
|
||||
/** The advanced editor's saved slider recipe, or null when it cannot be read. */
|
||||
function savedRecipe(json: string | null): unknown {
|
||||
if (!json) return null;
|
||||
try {
|
||||
const parsed = JSON.parse(json) as unknown;
|
||||
return parsed && typeof parsed === "object" ? parsed : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads the header dimensions without decoding the whole file. */
|
||||
async function imageSize(
|
||||
path: string,
|
||||
@@ -77,6 +88,12 @@ export const GET = async (
|
||||
width: sizes.get(row.id)?.width ?? 0,
|
||||
height: sizes.get(row.id)?.height ?? 0,
|
||||
takenAt: row.createdAt,
|
||||
// Reopening the editor restores the sliders exactly as they were saved;
|
||||
// the editor falls back to neutral when this is null.
|
||||
edits: savedRecipe(row.advancedEditJson),
|
||||
// Stamps the thumbnail URL so a newly saved edit is not masked by a
|
||||
// cached grid thumbnail from before it was rendered.
|
||||
editedAt: row.editedAt,
|
||||
})),
|
||||
editor: { returnUrl: bridgeReturnUrl(auth.session.eventId) },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user