fixed format getting set to 'misc' to all tracks on user-upped track

This commit is contained in:
uh wot 2021-12-04 20:18:48 +01:00
parent 1160a0e1ba
commit ce9fb730a2
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 5 additions and 4 deletions

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -134,7 +134,7 @@ router.get('/:type/:id', async request => {
}
let tagging = query.t
tagging = (tagging === 'true' || tagging === '1') && ['misc', '128', '320'].includes(format)
tagging = (tagging === 'true' || tagging === '1') && (['misc', '128', '320'].includes(format) || type !== 'track')
switch (type) {
case 'track':
@ -369,10 +369,11 @@ async function m3u8(type, id, format, tagging, host) {
let list = '#EXTM3U\n'
for (const track of json.tracks.data) {
let format_tmp = format
if (track.id < 0) { // user-uploaded track
format = 'misc'
format_tmp = 'misc'
}
let result = `https://${host}/track/${track.id}?f=${format}&t=${+ tagging}`
let result = `https://${host}/track/${track.id}?f=${format_tmp}&t=${+ tagging}`
list += `#EXTINF:${track.duration},${track.title}\n${result}\n`
}