Closed watameln closed 2 years ago
Doesn't work properly. Feel free to make a PR if you fixed the script
Didn't really fix it but you can see all experiments with it.
This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.
See this comment for the fix
const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]);
userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__;
nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes);
nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] });
oldGCUser = userMod.getCurrentUser;
userMod.getCurrentUser = () => { return { hasFlag: () => true }};
nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]();
userMod.getCurrentUser = oldGCUser;
// Thanks to 257109471589957632
This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.
const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]); userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__; nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes); nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] }); oldGCUser = userMod.getCurrentUser; userMod.getCurrentUser = () => { return { hasFlag: () => true }}; nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"](); userMod.getCurrentUser = oldGCUser; // Thanks to 257109471589957632
Well this doesn't work
Uncaught TypeError: Cannot read property 'nodes' of undefined at <anonymous>:1:139
This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.
const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]); userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__; nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes); nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] }); oldGCUser = userMod.getCurrentUser; userMod.getCurrentUser = () => { return { hasFlag: () => true }}; nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"](); userMod.getCurrentUser = oldGCUser; // Thanks to 257109471589957632
Well this doesn't work
Uncaught TypeError: Cannot read property 'nodes' of undefined at <anonymous>:1:139
Yeah, Discord patched it (all they did was nest it a little deeper smh). Here is the updated script:
(() => {
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.default._dispatcher._actionHandlers._dependencyGraph.nodes)
try {
nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({user: {flags: 1}})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser
})()
This is fixed with #57 (thanks to @spinfal), seems like GitHub didn't sync the PR properly with this issue.
Again broken
What currently works is
let wpRequire; window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]); mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined") usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers) nodes = Object.values(mod.exports.default._dispatcher._dependencyGraph.nodes) try { nodes.find(x => x.name == "ExperimentStore").actionHandler["CONNECTION_OPEN"]({user: {flags: 1}, type: "CONNECTION_OPEN"}) } catch (e) {} oldGetUser = usermod.exports.default.__proto__.getCurrentUser; usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true}) nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]() usermod.exports.default.__proto__.getCurrentUser = oldGetUser