OBJ then local
Deploy / deploy (push) Successful in 2m53s

This commit is contained in:
twotalesanimation
2026-07-16 23:04:15 +02:00
parent 9375d5212c
commit e756eb9015
3 changed files with 47 additions and 14 deletions
+12 -3
View File
@@ -4,7 +4,7 @@ import { db } from "@/lib/db";
import { uploadToHetzner, deleteFromHetzner } from "@/lib/storage";
import { recalcShotStatus } from "@/lib/shot-status";
export const maxDuration = 120;
export const maxDuration = 300; // 5 min — large .mov high-res files
/**
* POST /api/batch-upload/upload
@@ -46,6 +46,15 @@ export async function POST(
const buffer = Buffer.from(await file.arrayBuffer());
// Browsers (especially on Windows) often send an empty MIME type for .mov
// files. Fall back to a safe content type based on the file extension.
const ext = file.name.split(".").pop()?.toLowerCase();
const contentType =
file.type ||
(ext === "mov" ? "video/quicktime" :
ext === "mp4" ? "video/mp4" :
"application/octet-stream");
// ── High-res (.mov) ───────────────────────────────────────────────────────
if (action === "update-highres") {
const shot = await db.shot.findUnique({
@@ -61,7 +70,7 @@ export async function POST(
await deleteFromHetzner(shot.highResKey).catch(() => {});
}
const { key } = await uploadToHetzner(buffer, file.name, file.type, "highres");
const { key } = await uploadToHetzner(buffer, file.name, contentType, "highres");
await db.shot.update({
where: { id: shotId },
@@ -134,7 +143,7 @@ export async function POST(
}
// Upload the video to Hetzner object storage
const { key: videoKey } = await uploadToHetzner(buffer, file.name, file.type, "videos");
const { key: videoKey } = await uploadToHetzner(buffer, file.name, contentType, "videos");
const result = { url: `/api/files/${videoKey}`, key: videoKey };
// Mark all existing versions for this task as no longer latest