fix device limit bypass

This commit is contained in:
uh wot 2024-09-17 15:35:17 +02:00
parent 96f7b1e646
commit 970cfd2800
Signed by: uhwot
GPG Key ID: CB2454984587B781
1 changed files with 30 additions and 30 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.4.4 // @version 1.4.5
// @license GPL-3.0-only // @license GPL-3.0-only
// @homepageURL https://git.uhwot.cf/uhwot/dzunlock // @homepageURL https://git.uhwot.cf/uhwot/dzunlock
// @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -101,39 +101,39 @@ unsafeWindow.WebSocket = new Proxy(unsafeWindow.WebSocket, {
const url = args[0] const url = args[0]
const ws = new target(url) const ws = new target(url)
if (url !== 'wss://messaging.deezer.com/websocket') { if (!url.startsWith('wss://live.deezer.com/ws/')) {
return ws return ws
} else { }
log('hooking websocket')
return new Proxy(ws, { log('hooking websocket')
set: function (target, prop, val) {
if (prop == 'onmessage') { return new Proxy(ws, {
var onmsg = val; set: function (target, prop, val) {
val = function (e) { return target[prop] = val
if (e.data.includes('SingleInstancePlayback')) { },
log('preventing SingleInstancePlayback pubsub receive') get: function (target, prop) {
return var val = target[prop];
} if (prop == 'send') val = function (data) {
onmsg(e) const json = JSON.parse(data)
}; log(json)
} const [ msgType, subId ] = json
return target[prop] = val if (subId.endsWith('_STREAM')) {
}, if (msgType === 'sub') {
get: function (target, prop) { log('preventing play action subscription')
var val = target[prop];
if (prop == 'send') val = function (data) {
if (data.includes('SingleInstancePlayback')) {
log('preventing SingleInstancePlayback pubsub send')
return return
} }
target.send(data) if (msgType === 'send') {
}; log('preventing play action publish')
else if (typeof val == 'function') val = val.bind(target) return
return val }
} }
})
} target.send(data)
};
else if (typeof val == 'function') val = val.bind(target)
return val
}
})
} }
}) })