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
// @description enables deezer hifi features lol
// @author uh wot
// @version 1.4.4
// @version 1.4.5
// @license GPL-3.0-only
// @homepageURL https://git.uhwot.cf/uhwot/dzunlock
// @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 ws = new target(url)
if (url !== 'wss://messaging.deezer.com/websocket') {
if (!url.startsWith('wss://live.deezer.com/ws/')) {
return ws
} else {
log('hooking websocket')
}
return new Proxy(ws, {
set: function (target, prop, val) {
if (prop == 'onmessage') {
var onmsg = val;
val = function (e) {
if (e.data.includes('SingleInstancePlayback')) {
log('preventing SingleInstancePlayback pubsub receive')
return
}
onmsg(e)
};
}
return target[prop] = val
},
get: function (target, prop) {
var val = target[prop];
if (prop == 'send') val = function (data) {
if (data.includes('SingleInstancePlayback')) {
log('preventing SingleInstancePlayback pubsub send')
log('hooking websocket')
return new Proxy(ws, {
set: function (target, prop, val) {
return target[prop] = val
},
get: function (target, prop) {
var val = target[prop];
if (prop == 'send') val = function (data) {
const json = JSON.parse(data)
log(json)
const [ msgType, subId ] = json
if (subId.endsWith('_STREAM')) {
if (msgType === 'sub') {
log('preventing play action subscription')
return
}
target.send(data)
};
else if (typeof val == 'function') val = val.bind(target)
return val
}
})
}
if (msgType === 'send') {
log('preventing play action publish')
return
}
}
target.send(data)
};
else if (typeof val == 'function') val = val.bind(target)
return val
}
})
}
})