refact, option, allow linux headless
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
c15e3c306e
commit
c0ead118a2
@ -91,6 +91,8 @@ pub const LOGIN_MSG_PASSWORD_WRONG: &str = "Wrong Password";
|
||||
pub const LOGIN_MSG_NO_PASSWORD_ACCESS: &str = "No Password Access";
|
||||
pub const LOGIN_MSG_OFFLINE: &str = "Offline";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const LOGIN_SCREEN_WAYLAND: &str = "Wayland login screen";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version.";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str =
|
||||
@ -2100,7 +2102,13 @@ struct LoginErrorMsgBox {
|
||||
lazy_static::lazy_static! {
|
||||
static ref LOGIN_ERROR_MAP: Arc<HashMap<&'static str, LoginErrorMsgBox>> = {
|
||||
use hbb_common::config::LINK_HEADLESS_LINUX_SUPPORT;
|
||||
let map = HashMap::from([(LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LoginErrorMsgBox{
|
||||
let map = HashMap::from([(LOGIN_SCREEN_WAYLAND, LoginErrorMsgBox{
|
||||
msgtype: "error",
|
||||
title: "login_wayland_title_tip",
|
||||
text: "login_wayland_text_tip",
|
||||
link: "https://rustdesk.com/docs/en/manual/linux/#login-screen",
|
||||
try_again: true,
|
||||
}), (LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LoginErrorMsgBox{
|
||||
msgtype: "session-login",
|
||||
title: "",
|
||||
text: "",
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "管理的设备数已达到最大值"),
|
||||
("Sync with recent sessions", "同步最近会话"),
|
||||
("Sort tags", "对标签进行排序"),
|
||||
("login_wayland_title_tip", "无法连接"),
|
||||
("login_wayland_text_tip", "不支持 Wayland 登录界面。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "Sie haben die maximale Anzahl der verwalteten Geräte erreicht."),
|
||||
("Sync with recent sessions", "Synchronisierung mit den letzten Sitzungen"),
|
||||
("Sort tags", "Tags sortieren"),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -73,5 +73,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("clipboard_wait_response_timeout_tip", "Timed out waiting for copy response."),
|
||||
("logout_tip", "Are you sure you want to log out?"),
|
||||
("exceed_max_devices", "You have reached the maximum number of managed devices."),
|
||||
("login_wayland_title_tip", "Failed to connect"),
|
||||
("login_wayland_text_tip", "Login screen of Wayland is not supported."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "Has alcanzado el máximo número de dispositivos administrados."),
|
||||
("Sync with recent sessions", "Sincronizar con sesiones recientes"),
|
||||
("Sort tags", "Ordenar etiquetas"),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "Hai raggiunto il numero massimo di dispositivi gestibili."),
|
||||
("Sync with recent sessions", "Sincronizza con le sessioni recenti"),
|
||||
("Sort tags", "Ordina etichette"),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", "Достигнуто максимальне количество управляемых устройств."),
|
||||
("Sync with recent sessions", "Синхронизация последних сессий"),
|
||||
("Sort tags", "Сортировка меток"),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -524,5 +524,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("exceed_max_devices", ""),
|
||||
("Sync with recent sessions", ""),
|
||||
("Sort tags", ""),
|
||||
("login_wayland_title_tip", ""),
|
||||
("login_wayland_text_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -1007,14 +1007,22 @@ impl Connection {
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
if !self.file_transfer.is_some() && !self.port_forward_socket.is_some() {
|
||||
let dtype = crate::platform::linux::get_display_server();
|
||||
if dtype != crate::platform::linux::DISPLAY_SERVER_X11
|
||||
&& dtype != crate::platform::linux::DISPLAY_SERVER_WAYLAND
|
||||
{
|
||||
res.set_error(format!(
|
||||
"Unsupported display server type \"{}\", x11 or wayland expected",
|
||||
dtype
|
||||
));
|
||||
let mut msg = "".to_owned();
|
||||
if crate::platform::linux::is_login_wayland() {
|
||||
msg = crate::client::LOGIN_SCREEN_WAYLAND.to_owned();
|
||||
} else {
|
||||
let dtype = crate::platform::linux::get_display_server();
|
||||
if dtype != crate::platform::linux::DISPLAY_SERVER_X11
|
||||
&& dtype != crate::platform::linux::DISPLAY_SERVER_WAYLAND
|
||||
{
|
||||
msg = format!(
|
||||
"Unsupported display server type \"{}\", x11 or wayland expected",
|
||||
dtype
|
||||
);
|
||||
}
|
||||
}
|
||||
if !msg.is_empty() {
|
||||
res.set_error(msg);
|
||||
let mut msg_out = Message::new();
|
||||
msg_out.set_login_response(res);
|
||||
self.send(msg_out).await;
|
||||
@ -2387,7 +2395,11 @@ async fn start_ipc(
|
||||
args.push("--hide");
|
||||
};
|
||||
|
||||
#[cfg(any(feature = "flatpak", feature = "appimage", not(all(target_os = "linux", feature = "linux_headless"))))]
|
||||
#[cfg(any(
|
||||
feature = "flatpak",
|
||||
feature = "appimage",
|
||||
not(all(target_os = "linux", feature = "linux_headless"))
|
||||
))]
|
||||
let user = None;
|
||||
#[cfg(all(target_os = "linux", feature = "linux_headless"))]
|
||||
#[cfg(not(any(feature = "flatpak", feature = "appimage")))]
|
||||
|
Loading…
x
Reference in New Issue
Block a user