giorgi-o / CrossPlatformPlaying

BetterDiscord plugin that lets you see what your friends are playing even if they turned off game activity
59 stars 5 forks source link

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

Open ZeddPerm opened 2 years ago

ZeddPerm commented 2 years ago

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

+1

giorgi-o commented 2 years ago

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

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

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

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:

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.