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

DiscordRPC does not work inside the snap #946

Closed
Feichtmeier opened this issue Oct 12, 2024 · 4 comments · Fixed by #931
Closed

DiscordRPC does not work inside the snap #946

Feichtmeier opened this issue Oct 12, 2024 · 4 comments · Fixed by #931
Labels
bug 🐛 Something isn't working snap

Comments

@Feichtmeier
Copy link
Member

Feichtmeier commented Oct 12, 2024

Fails with

thread 'frb_workerpool' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/discord-rich-presence-0.2.4/src/ipc_unix.rs:90:43:
Client not connected
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Instance of 'PanicException'
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:128)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:70)
<asynchronous suspension>
#2      FlutterDiscordRPC.setActivity (package:flutter_discord_rpc/src/flutter_discord_rpc_base.dart:81)
<asynchronous suspension>

I am using this dart package which is using this rust package:

https://github.com/KRTirtho/frb_plugins/blob/main/packages/flutter_discord_rpc/native/Cargo.toml#L18C1-L18C22

in the rust package that is being there used this is the line where it wants to create a unix socket:

https://github.com/vionya/discord-rich-presence/blob/18ecbe78c7030a31932efb550e738fef94aa7a6b/src/ipc_unix.rs#L90

@kenvandine do you know if this doable with the snap with any plug/slot?
I disable this for now for linux and added a toggle setting for all inside settings

@soumyaDghosh
Copy link
Member

I know, how to fix it but it needs changes in the upstream source code. Basically, the code is searching in a path is non-existent to snap context.

In snap, the XDG_RUNTIME_DIR is /run/user/1000/snap.musicpod/

Now, discord-ipc is in /run/user/1000/snap.discord/. The snap.discord folder is accounted, but you cannot access this path normally from musicpod. So, for that the path of the ipc has to be like this

$XDG_RUNTIME_DIR/../snap.discord/ipc or wherever the discord ipc is.

The problem is, I am a very big noob in rust... So, not sure if I'll be able to fix it.

@Feichtmeier
Copy link
Member Author

Feichtmeier commented Oct 15, 2024

I know, how to fix it but it needs changes in the upstream source code. Basically, the code is searching in a path is non-existent to snap context.

In snap, the XDG_RUNTIME_DIR is /run/user/1000/snap.musicpod/

Now, discord-ipc is in /run/user/1000/snap.discord/. The snap.discord folder is accounted, but you cannot access this path normally from musicpod. So, for that the path of the ipc has to be like this

$XDG_RUNTIME_DIR/../snap.discord/ipc or wherever the discord ipc is.

The problem is, I am a very big noob in rust... So, not sure if I'll be able to fix it.

Wow thanks for this analysis!
And thank for the pull request 🤞🏻
vionya/discord-rich-presence#42

@soumyaDghosh
Copy link
Member

Needed to fix

@Feichtmeier
Copy link
Member Author

Thanks @soumyaDghosh !
The patch won't probably be merged unless you remove those print statements again :P

I need to resync our fork again with your branch of the rust dep
Then we could test the snap again

  • A rw access via system-files plug

what would we need to change inside snapcraft.yaml for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working snap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants