From df0627dea24e595285bd47f98000a9dfd347797f Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 20 Apr 2025 03:07:04 -0400 Subject: [PATCH] Comment out file existence check and response headers for track API --- index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.ts b/index.ts index c61339c..7fb8d46 100644 --- a/index.ts +++ b/index.ts @@ -9,7 +9,7 @@ Bun.serve({ "/api/track/:id": async req => { const trackId = parseInt(req.params.id) - const file = Bun.file(`downloaded/${trackId}.flac`) + /*const file = Bun.file(`downloaded/${trackId}.flac`) if (await file.exists()) { return new Response(await file.arrayBuffer(), { @@ -20,23 +20,23 @@ Bun.serve({ "ETag": trackId.toString(), } }) - } + }*/ const { manifestMimeType, manifest } = await utils.fetchTrack(trackId) const audio = await utils.tagFlac(trackId, await utils.downloadFlac(manifestMimeType, manifest)) - - await Bun.write(`downloaded/${trackId}.flac`, audio) + //await Bun.write(`downloaded/${trackId}.flac`, audio) return new Response(audio, { headers: { "Content-Type": "audio/flac", - "Content-Disposition": `attachment; filename="${trackId}.flac"`, + //"Content-Disposition": `attachment; filename="${trackId}.flac"`, "Cache-Control": "public, max-age=31536000", "ETag": trackId.toString(), } }) }, + "/api/@me/tracks": async () => { const tracks = await utils.fetchTracks();