Nightly: Drag & Drop Upload im Header (Admin) + Server-Upload-Endpoint (/api/upload, MP3/WAV)

This commit is contained in:
vibe-bot 2025-08-10 01:47:17 +02:00
parent c1f4d0f3a0
commit 9e7b572feb
3 changed files with 60 additions and 2 deletions

View file

@ -184,6 +184,22 @@ export async function playUrl(url: string, guildId: string, channelId: string, v
}
}
export async function uploadFile(file: File, folder?: string) {
const form = new FormData();
form.append('file', file);
if (folder) form.append('folder', folder);
const res = await fetch(`${API_BASE}/upload`, {
method: 'POST',
credentials: 'include',
body: form
});
if (!res.ok) {
const data = await res.json().catch(()=>({}));
throw new Error(data?.error || 'Upload failed');
}
return res.json();
}