Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NODE_OPTIONS for slack desktop #9

Open
devsnek opened this issue Nov 21, 2019 · 2 comments
Open

NODE_OPTIONS for slack desktop #9

devsnek opened this issue Nov 21, 2019 · 2 comments

Comments

@devsnek
Copy link

devsnek commented Nov 21, 2019

I don't use slack, but I thought it might be helpful to share this technique:

Create a file: /path/to/file.js
Set your NODE_OPTIONS to -r /path/to/file.js

Put some protections at the start, because this will now run every time any node.js starts on your computer.

(() => {
  if (typeof window === 'undefined') {
    return;
  }

  if (!window.location.href.includes('slack.com')) {
    return;
  }

  const redux = slackDebug[slackDebug.activeTeamId].redux;
  const {wysiwyg_composer, wysiwyg_composer_ios, wysiwyg_composer_webapp, ...payload} = redux.getState().experiments;
  redux.dispatch({ type: '[19] Bulk add experiment assignments to redux', payload });
})();
@devsnek devsnek changed the title NODE_OPTIONS for slack NODE_OPTIONS for slack desktop Nov 21, 2019
@Santiclause
Copy link

This is certainly a neat concept, but after hacking at it for a bit over an hour I can't find any way to leverage this technique for Slack, likely because it's an electron app, and you need this function to run inside the BrowserWindow directly

@devsnek
Copy link
Author

devsnek commented Nov 22, 2019

It should run inside the BrowserWindow, in fact prior to electron's preload. I've used this with some success on applications like Discord.

Did you set NODE_OPTIONS in your bashrc/zshrc/fish.config? If so, slack probably wouldn't see it. You'd need to put it somewhere like /etc/environment, /etc/launchd.conf, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants