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

Error: ENOENT: no such file or directory, lstat #8

Open
ZeddPerm opened this issue Sep 27, 2022 · 5 comments
Open

Error: ENOENT: no such file or directory, lstat #8

ZeddPerm opened this issue Sep 27, 2022 · 5 comments

Comments

@ZeddPerm
Copy link

This is an error I got when opening BetterDiscord. I believe this is due to Discord pushing a massive change, and breaking a lot of BetterDiscord Plugins.
image
image

@Ashesh3
Copy link

Ashesh3 commented Oct 1, 2022

+1

@giorgi-o
Copy link
Owner

giorgi-o commented Oct 2, 2022

I think the plugin's dead unfortunately, at least for now.

The BetterDiscord team apparently haven't ported the net node library when transitioning to electron v17, which is required for Riot, Epic, EA and Minecraft to work.

So unless they change their mind or I can find a workaround or something, it's a no-go for now :(

@ZeddPerm
Copy link
Author

ZeddPerm commented Oct 3, 2022

I asked in the BetterDiscord server, and it seems like there are plans to port the net node library into electron v17.
https://github.com/BetterDiscord/BetterDiscord/blob/main/preload/src/api/index.js#L43
image

@giorgi-o
Copy link
Owner

giorgi-o commented Oct 3, 2022

Just had a look, and indeed you can import the net module using const net = BetterDiscord.net.
However it seems to be some sort of chinese clone of the real net.

For example, calling net.createConnection(4242, "tcpbin.com"); returns an object that has all the properties of Socket, but isn't actually a Socket. It has no functions including no write() and on(), required for sending and receiving data.

I'll keep digging but this isn't a drop-in replacement.

Besides, the tls module still hasn't been ported (required for Riot). If net becomes available I could potentially use a third-party lib to handle the tls part, but it's not straightforward at all, and is very much just a last resort.

(thx to retr0 on discord for helping me with this btw)

@giorgi-o
Copy link
Owner

giorgi-o commented Oct 4, 2022

Update: thanks to the incredible retr0, we may have found a workaround. It involves injecting the plugin into the preload script in order to be able to un code in the main process.

On one hand, this seems overkill for just a betterdiscord plugin. But the more I think about it, the more it seems like the only option:

  • In the new electron version, they decided to further isolate contexts, basically breaking the net/tls modules in the render process. Being able to run it in main directly would solve that problem
  • this plugin has is much bigger than the typical plugin, which is usually just a UI change
  • being able to access main would open so many possibilities not possible in renderer, such as browser logins instead of messing with cookies/tokens for example

Overall I think electron has forced our hand in this, by essentially blockading the render process from doing anything more than, well, rendering. Which makes sense from a security perspective, but the alternative would be to ask everyone to install a separate lightweight helper exe, kinda like PreMID.

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

3 participants