fixed user-upped tracks

This commit is contained in:
uh wot 2021-09-01 15:11:17 +02:00
parent a92876194a
commit 4b8b3dde44
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 5 additions and 5 deletions

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -58,6 +58,10 @@ async function track(id, format, tagging) {
return new Response(JSON.stringify(json.error), { status: 403, headers: { 'content-type': "application/json" } }) return new Response(JSON.stringify(json.error), { status: 403, headers: { 'content-type': "application/json" } })
} }
if (json.id < 0) { // user-uploaded track
format = 'misc'
}
const wasm = await import('./pkg') const wasm = await import('./pkg')
encrypted = !['320', 'flac'].includes(format) encrypted = !['320', 'flac'].includes(format)
@ -213,10 +217,6 @@ function legacy_track_url(json, format, url_func) {
const md5_origin = json.md5_origin const md5_origin = json.md5_origin
const media_version = json.media_version const media_version = json.media_version
if (id < 0) { // user-uploaded track
format = 'misc'
}
if (json['filesize_' + format] == false) { if (json['filesize_' + format] == false) {
return new Response('Format unavailable', { status: 403, headers: { 'content-type': 'text/plain' } }) return new Response('Format unavailable', { status: 403, headers: { 'content-type': 'text/plain' } })
} }