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:
@@ -17,10 +17,12 @@ import { mediaStorage } from "@/lib/media-storage";
|
||||
* GET /api/events/:id/download
|
||||
*
|
||||
* Streams every photo on the event as one ZIP, preserving folder names. Saved
|
||||
* edits are included beside their originals as `<name>-edited.jpg`. The
|
||||
* archive is store-only: JPEGs and camera RAW files are already compressed, so
|
||||
* deflating them would add CPU and latency without shrinking the download.
|
||||
* Anyone assigned to the event (or a manager) can download it.
|
||||
* edits are included beside their originals as `<name>-edited.jpg`. With
|
||||
* `?edited=1` the archive contains only the saved edits, which is what a
|
||||
* photographer wants to hand on after a grading pass. The archive is
|
||||
* store-only: JPEGs and camera RAW files are already compressed, so deflating
|
||||
* them would add CPU and latency without shrinking the download. Anyone
|
||||
* assigned to the event (or a manager) can download it.
|
||||
*/
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
@@ -36,13 +38,22 @@ export const GET = async (
|
||||
// `?folderId=` narrows the archive to one folder, so a photographer can pull
|
||||
// just the shots they need without downloading the whole event.
|
||||
const folderId = req.nextUrl.searchParams.get("folderId")?.trim() || null;
|
||||
const onlyEdited = req.nextUrl.searchParams.get("edited") === "1";
|
||||
const photos = (await listEventPhotosForArchive(id)).filter(
|
||||
(photo) => !folderId || photo.folderId === folderId,
|
||||
(photo) =>
|
||||
(!folderId || photo.folderId === folderId) &&
|
||||
(!onlyEdited || Boolean(photo.editedStoredName)),
|
||||
);
|
||||
if (photos.length === 0) {
|
||||
return errorResponse(
|
||||
404,
|
||||
folderId ? "this folder has no photos" : "this event has no photos",
|
||||
onlyEdited
|
||||
? folderId
|
||||
? "this folder has no edited photos"
|
||||
: "this event has no edited photos"
|
||||
: folderId
|
||||
? "this folder has no photos"
|
||||
: "this event has no photos",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,13 +66,15 @@ export const GET = async (
|
||||
filename: string;
|
||||
storedName: string;
|
||||
}[] = [];
|
||||
for (const photo of photos) {
|
||||
entries.push({
|
||||
key: `${photo.id}:original`,
|
||||
folderName: photo.folderName,
|
||||
filename: photo.filename,
|
||||
storedName: photo.storedName,
|
||||
});
|
||||
if (!onlyEdited) {
|
||||
for (const photo of photos) {
|
||||
entries.push({
|
||||
key: `${photo.id}:original`,
|
||||
folderName: photo.folderName,
|
||||
filename: photo.filename,
|
||||
storedName: photo.storedName,
|
||||
});
|
||||
}
|
||||
}
|
||||
for (const photo of photos) {
|
||||
if (!photo.editedStoredName) continue;
|
||||
@@ -124,9 +137,14 @@ export const GET = async (
|
||||
"content-type": "application/zip",
|
||||
"content-disposition": photoContentDisposition(
|
||||
eventArchiveFilename(
|
||||
folderId
|
||||
? `${access.event.title} - ${photos[0].folderName}`
|
||||
: access.event.title,
|
||||
[
|
||||
folderId
|
||||
? `${access.event.title} - ${photos[0].folderName}`
|
||||
: access.event.title,
|
||||
onlyEdited ? "edited" : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" - "),
|
||||
),
|
||||
false,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user