// ==UserScript== // @name webpack-patcher spotify // @namespace http://tampermonkey.net/ // @version 2025-05-22 // @description Patches webpack modules // @author Vendicated, Arjix // @match https://open.spotify.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=spotify.com // @grant none // @run-at document-start // ==/UserScript== let done = false; window._submit = () => { if (done) return; if (!window._user || !window._auth) return; done = true; console.log('Ayoo', { username: window._user, authorization: window._auth }); } const patches = [ { find: /this\.namespace=(\w+)/, replacement: [ { match: /this\.namespace=(\w+)/, replace: (m, username) => `this.namespace=(()=>{ window._user = ${m}; _submit(); return window.username; })()` }, ] }, { find: "this._shouldSendAuthorization", replacement: [ { match: "this._shouldSendAuthorization&&", replace: "this._shouldSendAuthorization&&(()=>{ window._auth = this._accessToken; _submit(); return 1; })()&&" } ] } ]; /// ======== Do not touch the below! ======== function patchPush(e){function t(n){try{patchFactories(n[1])}catch(e){console.error("Error in handlePush",e)}return t.$$vencordOriginal.call(e,n)}t.$$vencordOriginal=e.push,t.toString=t.$$vencordOriginal.toString.bind(t.$$vencordOriginal),t.bind=(...e)=>t.$$vencordOriginal.bind(...e),Object.defineProperty(e,"push",{configurable:!0,get:()=>t,set(e){t.$$vencordOriginal=e}})}function patchFactories(e){for(const t in e){let n=e[t];const r=n,i=e[t]=function(e,t,i){try{n(e,t,i)}catch(o){if(n===r)throw o;return console.error("Error in patched module",o),void r(e,t,i)}t=e.exports};i.toString=r.toString.bind(r),i.original=r;let o="0,"+n.toString();for(let e=0;e