|
|
|
@@ -3,6 +3,7 @@ import { writeFile, mkdir, rename, unlink } from 'fs/promises'; |
|
|
|
import path from 'path'; |
|
|
|
import { fromBuffer as fileTypeFromBuffer } from 'file-type'; |
|
|
|
import { enqueueTranscode, needsTranscode, probeCodecs, isFfmpegAvailable } from '@/lib/transcode'; |
|
|
|
import { UPLOAD_LIMITS } from '@/lib/config'; |
|
|
|
|
|
|
|
export const dynamic = 'force-dynamic'; |
|
|
|
export const maxDuration = 300; |
|
|
|
@@ -31,11 +32,7 @@ const ALLOWED_MIMES: Record<string, string[]> = { |
|
|
|
pdf: ['application/pdf'], |
|
|
|
}; |
|
|
|
|
|
|
|
const MAX_BYTES: Record<Family, number> = { |
|
|
|
image: 25 * 1024 * 1024, // 25 MB |
|
|
|
pdf: 20 * 1024 * 1024, // 20 MB (pdfjs lato browser non regge bene di più) |
|
|
|
video: 1024 * 1024 * 1024, // 1 GB (verrà ricodificato lato server se necessario) |
|
|
|
}; |
|
|
|
const MAX_BYTES: Record<Family, number> = UPLOAD_LIMITS; |
|
|
|
|
|
|
|
const UPLOAD_DIR = path.join(process.cwd(), 'data', 'uploads'); |
|
|
|
const TMP_DIR = path.join(UPLOAD_DIR, '.tmp'); |
|
|
|
|