fix for 'the script will never generate a response'

This commit is contained in:
uh wot 2021-08-01 19:47:32 +02:00
parent 3fe1482da5
commit e96b2ade6d
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 5 additions and 2 deletions

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -187,7 +187,7 @@ async function track(id, format, access_token, tagging) {
const bfKey = await bf_key(id)
const length = Number(track.headers.get('Content-Length'))
pipeDecryptedStream(writer, track.body, length, bfKey, id3)
pipeDecryptedStream(writer, track.body, length, bfKey)
return new Response(readable, { status: 200, headers: { 'content-type': 'audio/mpeg' } })
}
@ -225,6 +225,9 @@ async function pipeDecryptedStream(writer, body, length, bfKey) {
writer.write(chunk)
byteCount += 2048
}
await reader.cancel()
await writer.close()
}
async function track_url(json, format) {