fix for 'the script will never generate a response'
This commit is contained in:
parent
3fe1482da5
commit
e96b2ade6d
File diff suppressed because one or more lines are too long
5
index.js
5
index.js
|
@ -187,7 +187,7 @@ async function track(id, format, access_token, tagging) {
|
||||||
const bfKey = await bf_key(id)
|
const bfKey = await bf_key(id)
|
||||||
const length = Number(track.headers.get('Content-Length'))
|
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' } })
|
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)
|
writer.write(chunk)
|
||||||
byteCount += 2048
|
byteCount += 2048
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await reader.cancel()
|
||||||
|
await writer.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function track_url(json, format) {
|
async function track_url(json, format) {
|
||||||
|
|
Loading…
Reference in New Issue