music and animation system

This commit is contained in:
2026-03-13 15:49:53 +01:00
parent 4916a2fc7b
commit 166ae50c49
24 changed files with 785 additions and 15 deletions

22
src/server/uploadthing.ts Normal file
View File

@@ -0,0 +1,22 @@
import { createUploadthing, type FileRouter as UploadThingFileRouter } from "uploadthing/next";
import { UTApi } from 'uploadthing/server'
import { isAdmin } from "~/app/actions";
const f = createUploadthing();
export const fileRouter = {
musicUploader: f({ audio: { maxFileSize: "64MB", maxFileCount: 1 } })
.middleware(async () => {
const admin = await isAdmin();
if (!admin) throw new Error("Unauthorized");
return {};
})
.onUploadComplete(async ({ file }) => {
console.log(file)
return { fileUrl: file.ufsUrl, fileKey: file.key, fileName: file.name };
}),
} satisfies UploadThingFileRouter ;
export type FileRouter = typeof fileRouter;
export const utapi = new UTApi();