Initial commit

This commit is contained in:
twotalesanimation
2026-05-19 22:20:29 +02:00
commit 0fbe856dce
173 changed files with 38316 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import { createUploadthing, type FileRouter } from "uploadthing/next";
import { auth } from "@/auth";
const f = createUploadthing();
export const uploadRouter = {
/** Full-resolution video upload (mp4, mov) */
versionVideo: f({
video: {
maxFileSize: "2GB",
maxFileCount: 1,
},
})
.middleware(async () => {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
return { userId: session.user.id };
})
.onUploadComplete(async ({ metadata, file }) => {
return { uploadedBy: metadata.userId, url: file.url };
}),
/** Thumbnail / poster image upload */
versionThumbnail: f({
image: {
maxFileSize: "4MB",
maxFileCount: 1,
},
})
.middleware(async () => {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
return { userId: session.user.id };
})
.onUploadComplete(async ({ metadata, file }) => {
return { uploadedBy: metadata.userId, url: file.url };
}),
} satisfies FileRouter;
export type OurFileRouter = typeof uploadRouter;