feat: establish server API routes for authentication, user management, and media processing.

This commit is contained in:
Michael committed 2026-03-02 13:33:23 +01:00
1 parent 94429e86df
commit 7e5c73cad9
1 file changed
+4 -3
+4 -3
View File
@@ -999,13 +999,14 @@ export async function registerRoutes(app: Express): Promise<Server> {
try { try {
console.log(`🎵 Audio saved locally: ${file.originalname} (${(file.size / 1024 / 1024).toFixed(2)} MB)`); console.log(`🎵 Audio saved locally: ${file.originalname} (${(file.size / 1024 / 1024).toFixed(2)} MB)`);
// Build a public URL served by Express at /uploads/audio/<filename> // Multer/busboy reçoit le nom en latin1, mais le navigateur l'envoie en UTF-8 → on reconvertit
const decodedName = Buffer.from(file.originalname, 'latin1').toString('utf8');
const publicUrl = `/uploads/audio/${file.filename}`; const publicUrl = `/uploads/audio/${file.filename}`;
const track = await storage.createAudioTrack({ const track = await storage.createAudioTrack({
userId: user.id, userId: user.id,
title: file.originalname.replace(/\.[^/.]+$/, ""), title: decodedName.replace(/\.[^/.]+$/, ""),
fileName: file.originalname, fileName: decodedName,
url: publicUrl, url: publicUrl,
duration: 0, duration: 0,
}); });