Discord-Oxygen / Discord-Console-hacks

A collection of JavaScript Codes I've made to enhance the User Experience of Discord and some other Discord related stuff
GNU General Public License v3.0
518 stars 110 forks source link

Experiments thing no longer works. #56

Closed watameln closed 2 years ago

watameln commented 2 years ago

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

hxr404 commented 2 years ago

Doesn't work properly. Feel free to make a PR if you fixed the script

watameln commented 2 years ago

Didn't really fix it but you can see all experiments with it.

spinfal commented 2 years ago

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
BlackusPL commented 2 years ago

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

spinfal commented 2 years ago

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
})()
hxr404 commented 2 years ago

This is fixed with #57 (thanks to @spinfal), seems like GitHub didn't sync the PR properly with this issue.

BlackusPL commented 2 years ago

Again broken