added device limit bypass

This commit is contained in:
uh wot 2022-07-24 21:09:05 +02:00
parent a21c19228b
commit a94074382c
Signed by: uhwot
GPG Key ID: CB2454984587B781
1 changed files with 43 additions and 1 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.8 // @version 1.4.0
// @license GPL-3.0-only // @license GPL-3.0-only
// @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock
// @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -95,6 +95,48 @@ window.addEventListener('DOMContentLoaded', (_) => {
})(unsafeWindow.dzPlayer.setTrackList); })(unsafeWindow.dzPlayer.setTrackList);
}); });
// https://greasyfork.org/en/scripts/38248-websocket-logger/code
unsafeWindow.WebSocket = new Proxy(unsafeWindow.WebSocket, {
construct: function (target, args, _) {
const url = args[0]
const ws = new target(url)
if (url !== 'wss://messaging.deezer.com/websocket') {
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')
return
}
target.send(data)
};
else if (typeof val == 'function') val = val.bind(target)
return val
}
})
}
}
})
unsafeWindow.fetch = (function (fetch) { unsafeWindow.fetch = (function (fetch) {
return async function (url, init) { return async function (url, init) {
if (url === 'https://media.deezer.com/v1/get_url') { if (url === 'https://media.deezer.com/v1/get_url') {