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,32 +101,33 @@ 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') log('hooking websocket')
return new Proxy(ws, { return new Proxy(ws, {
set: function (target, prop, val) { 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 return target[prop] = val
}, },
get: function (target, prop) { get: function (target, prop) {
var val = target[prop]; var val = target[prop];
if (prop == 'send') val = function (data) { if (prop == 'send') val = function (data) {
if (data.includes('SingleInstancePlayback')) { const json = JSON.parse(data)
log('preventing SingleInstancePlayback pubsub send') log(json)
const [ msgType, subId ] = json
if (subId.endsWith('_STREAM')) {
if (msgType === 'sub') {
log('preventing play action subscription')
return return
} }
if (msgType === 'send') {
log('preventing play action publish')
return
}
}
target.send(data) target.send(data)
}; };
else if (typeof val == 'function') val = val.bind(target) else if (typeof val == 'function') val = val.bind(target)
@ -134,7 +135,6 @@ unsafeWindow.WebSocket = new Proxy(unsafeWindow.WebSocket, {
} }
}) })
} }
}
}) })
let last_track_id = null let last_track_id = null