made code slightly less shitty

This commit is contained in:
uh wot 2021-09-15 17:43:53 +02:00
parent 3861935ddc
commit fecd248a53
Signed by: uhwot
GPG Key ID: CB2454984587B781
1 changed files with 4 additions and 9 deletions

View File

@ -3,7 +3,7 @@
// @namespace io.github.uhwot.dzunlock // @namespace io.github.uhwot.dzunlock
// @description enables deezer hifi features lol // @description enables deezer hifi features lol
// @author uh wot // @author uh wot
// @version 1.3 // @version 1.3.1
// @license GPL-3.0-only // @license GPL-3.0-only
// @homepageURL https://git.freezer.life/uhwot/dzunlock // @homepageURL https://git.freezer.life/uhwot/dzunlock
// @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -159,16 +159,11 @@ fetchIntercept.register({
const track = unsafeWindow.dzPlayer.getCurrentSong() const track = unsafeWindow.dzPlayer.getCurrentSong()
const id = parseInt(track.SNG_ID) const id = parseInt(track.SNG_ID)
let user_status_quality = quality
if (user_status_quality === 'high') {
user_status_quality = 'hq'
}
let is_subbed = !unsafeWindow.dzPlayer.user_status.can_subscribe let is_subbed = !unsafeWindow.dzPlayer.user_status.can_subscribe
let is_quality_available = unsafeWindow.dzPlayer.user_status[user_status_quality] let is_quality_available = unsafeWindow.dzPlayer.user_status.audio_qualities.wifi_download.includes(quality)
// STREAM_ADS_AVAILABLE is used to check if track is restricted to premium/hifi // STREAM_ADS_AVAILABLE is used to check if track is restricted to premium/hifi
if (quality === 'standard' && (track.RIGHTS.STREAM_ADS_AVAILABLE === true || is_subbed)) { if (track.RIGHTS.STREAM_ADS_AVAILABLE !== true && !is_subbed) {
is_quality_available = true is_quality_available = false
} }
if (id >= 0 && !is_quality_available) { if (id >= 0 && !is_quality_available) {