From 3298f125c77bd194038b7f2846f7cc58d011fbe4 Mon Sep 17 00:00:00 2001 From: uh wot Date: Mon, 22 Nov 2021 00:09:57 +0100 Subject: [PATCH 01/10] updated urls --- dzunlock.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index 6a69b1e..b7bccc2 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,10 +3,10 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.3 +// @version 1.3.4 // @license GPL-3.0-only -// @homepageURL https://git.freezer.life/uhwot/dzunlock -// @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js +// @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock +// @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @icon https://cdns-files.dzcdn.net/cache/images/common/favicon/favicon-96x96.852baf648e79894b668670e115e4a375.png // @include /^https:\/\/www\.deezer\.com\/[a-z]{2}\/($|track|album|artist|playlist|episode|show|profile|channels|podcasts|radio|\?|#)/ // @match https://www.deezer.com/search/* From ff1d8d2351b1ff6be34803792b9f953ff965cfa8 Mon Sep 17 00:00:00 2001 From: uh wot Date: Mon, 22 Nov 2021 00:11:11 +0100 Subject: [PATCH 02/10] updated url in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10efd7c..b330e0b 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ enables deezer hifi features lol - install [violentmonke](https://violentmonkey.github.io/) (other userscript extensions may work, but are not supported) -- click [this link](https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js) \ No newline at end of file +- click [this link](https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js) \ No newline at end of file From 795b7fd1bb63aecf5c8fa04844ec30f6b1240605 Mon Sep 17 00:00:00 2001 From: uh wot Date: Thu, 10 Feb 2022 00:42:01 +0100 Subject: [PATCH 03/10] disabled skip limit on mixes --- dzunlock.user.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index b7bccc2..9387bbe 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.4 +// @version 1.3.5 // @license GPL-3.0-only // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -126,6 +126,8 @@ function playerTokenPatch(playerToken) { // disables previews playerToken.streaming = true playerToken.limited = false + // disables skip limit on mixes + playerToken.radio_skips = 0 log(playerToken) From 7891c8a093b04872aa741dd37cf9c7c0ed6a021e Mon Sep 17 00:00:00 2001 From: uh wot Date: Fri, 18 Mar 2022 20:40:02 +0100 Subject: [PATCH 04/10] replaced fetch library crap --- dzunlock.user.js | 106 +++++++---------------------------------------- 1 file changed, 14 insertions(+), 92 deletions(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index 9387bbe..e5b5302 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.5 +// @version 1.3.6 // @license GPL-3.0-only // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -26,65 +26,6 @@ function log(...args) { } } -// https://github.com/werk85/fetch-intercept/blob/develop/src/attach.js modified for browser support -let interceptors = []; - -function interceptor(fetch, ...args) { - const reversedInterceptors = interceptors.reduce((array, interceptor) => [interceptor].concat(array), []); - let promise = Promise.resolve(args); - - // Register request interceptors - reversedInterceptors.forEach(({ request, requestError }) => { - if (request || requestError) { - promise = promise.then(args => request(...args), requestError); - } - }); - - // Register fetch call - promise = promise.then(args => { - const request = new Request(...args); - return fetch(request).then(response => { - response.request = request; - return response; - }).catch(error => { - error.request = request; - return Promise.reject(error); - }); - }); - - // Register response interceptors - reversedInterceptors.forEach(({ response, responseError }) => { - if (response || responseError) { - promise = promise.then(response, responseError); - } - }); - - return promise; -} - -unsafeWindow.fetch = (function (fetch) { - return function (...args) { - return interceptor(fetch, ...args); - }; -})(unsafeWindow.fetch); - -fetchIntercept = { - register: function (interceptor) { - interceptors.push(interceptor); - return () => { - const index = interceptors.indexOf(interceptor); - if (index >= 0) { - interceptors.splice(index, 1); - } - }; - }, - clear: function () { - interceptors = []; - } -}; - -// main code starts here - const playerTokenKey = [102, 228, 95, 242, 215, 50, 122, 26, 57, 216, 206, 38, 164, 237, 200, 85] const cipher = new aesjs.ModeOfOperation.ecb(playerTokenKey) @@ -154,9 +95,8 @@ window.addEventListener('DOMContentLoaded', (_) => { })(unsafeWindow.dzPlayer.setTrackList); }); -fetchIntercept.register({ - request: function (url, config) { - // Modify the url or config here +unsafeWindow.fetch = (function (fetch) { + return async function (url, init) { if (url === 'https://media.deezer.com/v1/get_url') { const quality = unsafeWindow.dzPlayer.control.getAudioQuality() const track = unsafeWindow.dzPlayer.getCurrentSong() @@ -186,24 +126,14 @@ fetchIntercept.register({ } } - config.body = JSON.stringify(body) + init.body = JSON.stringify(body) } } - return [url, config]; - }, + let resp = await fetch(url, init) - requestError: function (error) { - // Called when an error occured during another 'request' interceptor call - - return Promise.reject(error); - }, - - response: async function (response) { - // Modify the response object - - if (response.url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=deezer.getUserData')) { - let json = await response.json() + if (url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=deezer.getUserData')) { + let json = await resp.json() // removes upgrade popup stuff json.results.USER.ENTRYPOINTS = {} @@ -217,25 +147,17 @@ fetchIntercept.register({ log(json) - return new Response(JSON.stringify(json)) - } - - if (response.url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=log.listen')) { - const json = await response.json() + resp = new Response(JSON.stringify(json), resp) + } else if (url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=log.listen')) { + const json = await resp.json() if (typeof json.results === 'string') { json.results = playerTokenPatch(json.results) } - return new Response(JSON.stringify(json)) + resp = new Response(JSON.stringify(json), resp) } - return response; - }, - - responseError: function (error) { - // Handle an fetch error - - return Promise.reject(error); - } -}); \ No newline at end of file + return resp + }; +})(unsafeWindow.fetch); \ No newline at end of file From 0ac770d844f7a642aeadb27fe83a43ee60f657db Mon Sep 17 00:00:00 2001 From: uh wot Date: Fri, 17 Jun 2022 01:56:23 +0200 Subject: [PATCH 05/10] removed more popup crap --- dzunlock.user.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index e5b5302..74de154 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.6 +// @version 1.3.7 // @license GPL-3.0-only // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -147,6 +147,13 @@ unsafeWindow.fetch = (function (fetch) { log(json) + resp = new Response(JSON.stringify(json), resp) + } else if (url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=deezer.userMenu')) { + let json = await resp.json() + + delete json.results.MARKETING_PUSH + delete json.results.MARKETING_PUSH_DATA + resp = new Response(JSON.stringify(json), resp) } else if (url.startsWith('https://www.deezer.com/ajax/gw-light.php?method=log.listen')) { const json = await resp.json() From a21c19228b668250b9fdf89460e4296a28ff34db Mon Sep 17 00:00:00 2001 From: uh wot Date: Tue, 21 Jun 2022 02:36:45 +0200 Subject: [PATCH 06/10] fixed gapless playback --- dzunlock.user.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index 74de154..7f159f9 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.7 +// @version 1.3.8 // @license GPL-3.0-only // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -98,8 +98,14 @@ window.addEventListener('DOMContentLoaded', (_) => { unsafeWindow.fetch = (function (fetch) { return async function (url, init) { if (url === 'https://media.deezer.com/v1/get_url') { + let track + if (unsafeWindow.dzPlayer.getPosition() === 0) { + track = unsafeWindow.dzPlayer.getCurrentSong() + } else { + track = unsafeWindow.dzPlayer.getNextSong() // gapless playback + } + const quality = unsafeWindow.dzPlayer.control.getAudioQuality() - const track = unsafeWindow.dzPlayer.getCurrentSong() const id = parseInt(track.SNG_ID) let is_subbed = !unsafeWindow.dzPlayer.user_status.can_subscribe From a94074382c8dc8615180b6acdba67cd86859bcfa Mon Sep 17 00:00:00 2001 From: uh wot Date: Sun, 24 Jul 2022 21:09:05 +0200 Subject: [PATCH 07/10] added device limit bypass --- dzunlock.user.js | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index 7f159f9..568a137 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.3.8 +// @version 1.4.0 // @license GPL-3.0-only // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -95,6 +95,48 @@ window.addEventListener('DOMContentLoaded', (_) => { })(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) { return async function (url, init) { if (url === 'https://media.deezer.com/v1/get_url') { From 725f846b770726a70b84025c30e28968a8700f4c Mon Sep 17 00:00:00 2001 From: uh wot Date: Wed, 17 Aug 2022 14:31:20 +0200 Subject: [PATCH 08/10] changed homepage / download urls --- README.md | 2 +- dzunlock.user.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b330e0b..c33f10c 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ enables deezer hifi features lol - install [violentmonke](https://violentmonkey.github.io/) (other userscript extensions may work, but are not supported) -- click [this link](https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js) \ No newline at end of file +- click [this link](https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js) diff --git a/dzunlock.user.js b/dzunlock.user.js index 568a137..1409983 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,10 +3,10 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.4.0 +// @version 1.4.1 // @license GPL-3.0-only -// @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock -// @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js +// @homepageURL https://uhwotgit.fly.dev/uhwot/dzunlock +// @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @icon https://cdns-files.dzcdn.net/cache/images/common/favicon/favicon-96x96.852baf648e79894b668670e115e4a375.png // @include /^https:\/\/www\.deezer\.com\/[a-z]{2}\/($|track|album|artist|playlist|episode|show|profile|channels|podcasts|radio|\?|#)/ // @match https://www.deezer.com/search/* @@ -215,4 +215,4 @@ unsafeWindow.fetch = (function (fetch) { return resp }; -})(unsafeWindow.fetch); \ No newline at end of file +})(unsafeWindow.fetch); From 86a2b45689ad93835c945c11754bc1b437bec5c0 Mon Sep 17 00:00:00 2001 From: uh wot Date: Wed, 17 Aug 2022 15:06:44 +0200 Subject: [PATCH 09/10] changed default media server --- dzunlock.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index 1409983..b74cd00 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,7 +3,7 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.4.1 +// @version 1.4.2 // @license GPL-3.0-only // @homepageURL https://uhwotgit.fly.dev/uhwot/dzunlock // @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js @@ -158,7 +158,7 @@ unsafeWindow.fetch = (function (fetch) { } if (id >= 0 && !is_quality_available) { - const media_server = GM_getValue('media_server', 'https://dzmedia.herokuapp.com') + const media_server = GM_getValue('media_server', 'https://dzmedia.fly.dev') url = `${media_server}/get_url` const body = { From e7c610f089b4b98d6df3c1878a4db5821c7ff01f Mon Sep 17 00:00:00 2001 From: uh wot Date: Tue, 23 Aug 2022 14:55:07 +0200 Subject: [PATCH 10/10] changed homepage url --- dzunlock.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dzunlock.user.js b/dzunlock.user.js index b74cd00..0f45cfe 100644 --- a/dzunlock.user.js +++ b/dzunlock.user.js @@ -3,9 +3,9 @@ // @namespace io.github.uhwot.dzunlock // @description enables deezer hifi features lol // @author uh wot -// @version 1.4.2 +// @version 1.4.3 // @license GPL-3.0-only -// @homepageURL https://uhwotgit.fly.dev/uhwot/dzunlock +// @homepageURL https://git.uhwot.cf/uhwot/dzunlock // @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @icon https://cdns-files.dzcdn.net/cache/images/common/favicon/favicon-96x96.852baf648e79894b668670e115e4a375.png // @include /^https:\/\/www\.deezer\.com\/[a-z]{2}\/($|track|album|artist|playlist|episode|show|profile|channels|podcasts|radio|\?|#)/