From ecdeced95ecfd508c8b74a6d46024a3e2e2e2b8c Mon Sep 17 00:00:00 2001 From: apatil Date: Wed, 7 May 2025 20:58:10 +0100 Subject: [PATCH] Adding support to return all audio types --- src/app/api/tracks/route.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/api/tracks/route.ts b/src/app/api/tracks/route.ts index c57bec7..d0a4d2b 100644 --- a/src/app/api/tracks/route.ts +++ b/src/app/api/tracks/route.ts @@ -3,6 +3,12 @@ import { NextResponse } from 'next/server'; const MUSIC_DIR = '/app/music'; export async function GET() { - const files = fs.readdirSync(MUSIC_DIR).filter((f) => f.endsWith('.mp3')); + const files = fs + .readdirSync(MUSIC_DIR) + .filter((f) => + ['.mp3', '.m4a', 'audio/mpeg', 'audio/mp4', 'audio/x-m4a'].some((suffix) => + f.endsWith(suffix), + ), + ); return NextResponse.json(files); }