Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Flatpak is one of the many, many confusing ways that Linux packages software
if you ran a third party client as a Flatpak (notably Vesktop, but other options are available (Legcord or Equibop)), Perigee couldn't find them. they put their IPC socket in
$XDG_RUNTIME_DIR/.flatpak/<app-id>/xdg-run/discord-ipc-0and that never got checked.This PR adds a check to flatpak sockets.
Changes
1. Scan every
.flatpak/*/xdg-run/EndpointResolvernow lists$XDG_RUNTIME_DIR/.flatpak/and adds any app folder that has anxdg-runinside it. Any Flatpak client (current or future!) gets found. No.flatpak/or can't read it returns empty list, same behaviour as before. Any other folder such as per-instance folders like1234567890and1234567890-privatehave noxdg-run, so they're skipped.This does pick up flatpaks that aren't discord at all, though, should they have an xgd-run folder. on my machine it found surfshark, for example, but since surfshark has no
discord-ipc-nit fails on no such file.resolve()now reads disk, therefore, where it used to just glue strings together from env and its arguments. now it callsflatpakRuntimeDirsinside theXDG_RUNTIME_DIRbranch, which runsFiles.liston.flatpak/andFiles.isDirectoryon eachxdg-run. Benefit of this is to not have to add a line every time a new client turns up on Flathub.2. Log which endpoint failed
While checking the above I found that a failed connect is kinda useless to debug. The JDK's Unix socket errors don't include the path so the suppressed exceptions were about 100 copies of
No such file or directoryand nothing else. each one now reads like this:3. Test Changes
New test: a temp runtime dir with
dev.vencord.Vesktop/xdg-run/and an instance folder. Vesktop is found after the sandboxes, and the instance folder isn't.unixFollowsDocumentedOrderWithSandboxesAndFallbacknow uses/run/user/1instead of/run/user/1000.resolve()reads the disk, and/run/user/1000is a real folder on most Linux desktops (including mine, hence Surfshark turning up in the expected list). uid 1 (or any number under 1000 except 0) never logs in so the folder never exists.reportsHowDiscordTreatsEachActivityTypeused to time out on its last clear. That was the test's fault: it sends 6 updates inside Discord's 5-per-20-seconds presence limit and only waited 10 seconds for the 6th, which the rate limiter was holding back exactly like it should. It now waits 30.tested on arch. tested with extra/discord, aur/vesktop, and flatpak discord (Flathub
com.discordapp.Discord).flatpak/com.discordapp.Discord/xdg-run/discord-ipc-0app/com.discordapp.Discord/discord-ipc-0SANDBOX_SUBDIRSdiscord-ipc-0$XDG_RUNTIME_DIRdiscord-ipc-1$XDG_RUNTIME_DIRthe first one is the real socket, the second only exists because the Flathub package runs
socatto forwardapp/...to it, which is the whole reason the hard-coded path ever worked. Vesktop and others don't ship that forwarder soxdg-runis all they've got.thank you for reading! i actually genuinely wrote all of this