fix(linux): report the process user as the active user under Flatpak (#16519)

File transfer to a Flatpak peer always failed with "No active console
user logged on", because PeerInfo.username came from loginctl, which the
sandbox cannot reach: Flathub builds lack the org.freedesktop.Flatpak
talk-name, so `flatpak-spawn --host` fails. A Flatpak instance only runs
inside the logged-in user's own session, so that user is the active one.

Fixes #16506


Claude-Session: https://claude.ai/code/session_01WS1HTjp6UQuG43KEcQPq1R

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RustDesk
2026-10-10 16:44:10 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 67090d3aa1
commit 4411d10f45
+5
View File
@@ -1302,6 +1302,11 @@ fn _get_display_manager() -> String {
/// Returns the cached active username when available.
/// Callers that require a fresh seat0 lookup should call `get_values_of_seat0` directly.
pub fn get_active_username() -> String {
// Flatpak runs only inside the logged-in user's session, and Flathub builds
// cannot reach the host's loginctl.
if is_flatpak() {
return crate::username();
}
if let Some((_, username)) = get_active_user_id_name_from_cache() {
return username;
}