CrossPlatformPlaying
CrossPlatformPlaying copied to clipboard
Error: ENOENT: no such file or directory, lstat
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.
+1
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 :(
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
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)
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.