Skip to content

Instantly share code, notes, and snippets.

@MeguminSama
Last active December 19, 2024 14:45
Show Gist options
  • Save MeguminSama/2cae24c9e4c335c661fa94e72235d4c4 to your computer and use it in GitHub Desktop.
Save MeguminSama/2cae24c9e4c335c661fa94e72235d4c4 to your computer and use it in GitHub Desktop.
Discord Experiments.js
let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUser).exports.default;
var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
var user = UserStore.getCurrentUser();
actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
});
actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
@MeguminSama
Copy link
Author

@Zyrenth thanks for the patch. Gist has been updated.

@vstudiocode
Copy link

very h

@NightSprite
Copy link

works as of may 2024

@CamperSamu
Copy link

Another patch because we love discord: (as of writing this the update is only pushed to canary and ptb)

This is still working, but if you're on linux and you're using wayland don't use this if you intend to stream since it breaks the new wayland screensharing tool.
I think it has something to do with it being some experiment that gets disabled by this snippet, but I couldn't get to the specific reason at 3AM.
I bisected the script and it happens after running the first actions.find, if someone that knows how discord works wants to help figure out a fix it would be great.

@MeguminSama
Copy link
Author

it could be worth grabbing the current experiments list and reinserting that into the CONNECTION_OPEN payload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment