Adding support to return all audio types
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c76cbbb5f7
commit
ecdeced95e
@ -3,6 +3,12 @@ import { NextResponse } from 'next/server';
|
|||||||
|
|
||||||
const MUSIC_DIR = '/app/music';
|
const MUSIC_DIR = '/app/music';
|
||||||
export async function GET() {
|
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);
|
return NextResponse.json(files);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user