From 73358502e93062d3012fbcc223e322d911e1f8c4 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 1 Apr 2023 00:28:56 +0800 Subject: [PATCH] linux headless feature, tmp commit Signed-off-by: fufesou --- Cargo.toml | 5 +- libs/hbb_common/src/config.rs | 13 ++- src/client.rs | 119 +++++++++++++++++--------- src/client/io_loop.rs | 1 + src/lang/ca.rs | 16 +++- src/lang/cn.rs | 16 +++- src/lang/cs.rs | 16 +++- src/lang/da.rs | 16 +++- src/lang/de.rs | 16 +++- src/lang/el.rs | 16 +++- src/lang/en.rs | 15 ++++ src/lang/eo.rs | 16 +++- src/lang/es.rs | 16 +++- src/lang/fa.rs | 16 +++- src/lang/fr.rs | 1 - src/lang/hu.rs | 16 +++- src/lang/id.rs | 16 +++- src/lang/it.rs | 16 +++- src/lang/ja.rs | 16 +++- src/lang/ko.rs | 16 +++- src/lang/kz.rs | 16 +++- src/lang/nl.rs | 16 +++- src/lang/pl.rs | 16 +++- src/lang/pt_PT.rs | 16 +++- src/lang/ptbr.rs | 16 +++- src/lang/ro.rs | 16 +++- src/lang/ru.rs | 16 +++- src/lang/sk.rs | 16 +++- src/lang/sl.rs | 16 +++- src/lang/sq.rs | 16 +++- src/lang/sr.rs | 16 +++- src/lang/sv.rs | 16 +++- src/lang/template.rs | 16 +++- src/lang/th.rs | 16 +++- src/lang/tr.rs | 16 +++- src/lang/tw.rs | 16 +++- src/lang/ua.rs | 16 +++- src/lang/vn.rs | 16 +++- src/platform/linux_desktop_manager.rs | 81 ++++++++++++++++-- src/platform/mod.rs | 2 +- src/rendezvous_mediator.rs | 4 +- src/server/connection.rs | 105 +++++++++++------------ 42 files changed, 713 insertions(+), 145 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 10f90f387..48bd16045 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ flutter = ["flutter_rust_bridge"] default = ["use_dasp"] hwcodec = ["scrap/hwcodec"] mediacodec = ["scrap/mediacodec"] +linux_headless = ["pam", "users"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -122,8 +123,8 @@ mouce = { git="https://github.com/fufesou/mouce.git" } evdev = { git="https://github.com/fufesou/evdev" } dbus = "0.9" dbus-crossroads = "0.5" -pam = { git="https://github.com/fufesou/pam" } -users = "0.11.0" +pam = { git="https://github.com/fufesou/pam", optional = true } +users = { version = "0.11.0", optional = true } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.11" diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 3841bf976..e6c788f9a 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -64,11 +64,15 @@ lazy_static::lazy_static! { pub static ref APP_HOME_DIR: Arc> = Default::default(); } -// #[cfg(any(target_os = "android", target_os = "ios"))] +pub const LINK_DOCS_HOME: &str = "https://rustdesk.com/docs/en/"; +pub const LINK_DOCS_X11_REQUIRED: &str = "https://rustdesk.com/docs/en/manual/linux/#x11-required"; +pub const LINK_HEADLESS_LINUX_SUPPORT: &str = + "https://github.com/rustdesk/rustdesk/wiki/Headless-Linux-Support"; lazy_static::lazy_static! { pub static ref HELPER_URL: HashMap<&'static str, &'static str> = HashMap::from([ - ("rustdesk docs home", "https://rustdesk.com/docs/en/"), - ("rustdesk docs x11-required", "https://rustdesk.com/docs/en/manual/linux/#x11-required"), + ("rustdesk docs home", LINK_DOCS_HOME), + ("rustdesk docs x11-required", LINK_DOCS_X11_REQUIRED), + ("rustdesk x11 headless", LINK_HEADLESS_LINUX_SUPPORT), ]); } @@ -917,7 +921,8 @@ impl PeerConfig { store = store || store2; for opt in ["rdp_password", "os-username", "os-password"] { if let Some(v) = config.options.get_mut(opt) { - let (encrypted, _, store2) = decrypt_str_or_original(v, PASSWORD_ENC_VERSION); + let (encrypted, _, store2) = + decrypt_str_or_original(v, PASSWORD_ENC_VERSION); *v = encrypted; store = store || store2; } diff --git a/src/client.rs b/src/client.rs index 741c45416..3f587dfe0 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1912,6 +1912,71 @@ fn _input_os_password(p: String, activate: bool, interface: impl Interface) { interface.send(Data::Message(msg_out)); } +#[derive(Copy, Clone)] +struct LoginErrorMsgBox { + msgtype: &'static str, + title: &'static str, + text: &'static str, + link: &'static str, + try_again: bool, +} + +lazy_static::lazy_static! { + static ref LOGIN_ERROR_MAP: Arc> = { + use hbb_common::config::LINK_HEADLESS_LINUX_SUPPORT; + let map = HashMap::from([(crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LoginErrorMsgBox{ + msgtype: "session-login", + title: "session_not_ready_title_tip", + text: "session_not_ready_text_tip", + link: "", + try_again: true, + }), (crate::server::LOGIN_MSG_DESKTOP_XSESSION_FAILED, LoginErrorMsgBox{ + msgtype: "session-re-login", + title: "xsession_failed_title_tip", + text: "xsession_failed_text_tip", + link: "", + try_again: true, + }), (crate::server::LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER, LoginErrorMsgBox{ + msgtype: "info", + title: "another_user_login_title_tip", + text: "another_user_login_text_tip", + link: "", + try_again: false, + }), (crate::server::LOGIN_MSG_DESKTOP_XORG_NOT_FOUND, LoginErrorMsgBox{ + msgtype: "session-re-login", + title: "xorg_not_found_title_tip", + text: "xorg_not_found_text_tip", + link: LINK_HEADLESS_LINUX_SUPPORT, + try_again: true, + }), (crate::server::LOGIN_MSG_DESKTOP_NO_DESKTOP, LoginErrorMsgBox{ + msgtype: "session-re-login", + title: "no_desktop_title_tip", + text: "no_desktop_text_tip", + link: LINK_HEADLESS_LINUX_SUPPORT, + try_again: true, + }), (crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY, LoginErrorMsgBox{ + msgtype: "session-login-password", + title: "session_unready_no_password_title_tip", + text: "session_unready_no_password_text_tip", + link: "", + try_again: true, + }), (crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG, LoginErrorMsgBox{ + msgtype: "session-login-re-password", + title: "session_unready_wrong_password_title_tip", + text: "session_unready_wrong_password_text_tip", + link: "", + try_again: true, + }), (crate::server::LOGIN_MSG_NO_PASSWORD_ACCESS, LoginErrorMsgBox{ + msgtype: "wait-remote-accept-nook", + title: "Prompt", + text: "no_password_access_text_tip", + link: "", + try_again: true, + })]); + Arc::new(map) + }; +} + /// Handle login error. /// Return true if the password is wrong, return false if there's an actual error. pub fn handle_login_error( @@ -1927,47 +1992,19 @@ pub fn handle_login_error( lc.write().unwrap().password = Default::default(); interface.msgbox("re-input-password", err, "Do you want to enter again?", ""); true - } else if err == crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY { - interface.msgbox( - "session-login", - "session is unready", - "Input linux user/password", - "", - ); - true - } else if err == crate::server::LOGIN_MSG_DESKTOP_XSESSION_FAILED { - interface.msgbox( - "session-re-login", - "xsession username/password is wrong", - "Do you want to enter again?", - "", - ); - true - } else if err == crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY { - interface.msgbox( - "session-login-password", - "session is unready", - "Input connection password and linux user/password", - "", - ); - true - } else if err == crate::server::LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG { - interface.msgbox( - "session-login-re-password", - "session is unready and password is wrong", - "Do you want to enter again?", - "", - ); - true - } else if err == "No Password Access" { - lc.write().unwrap().password = Default::default(); - interface.msgbox( - "wait-remote-accept-nook", - "Prompt", - "Please wait for the remote side to accept your session request...", - "", - ); - true + } else if LOGIN_ERROR_MAP.contains_key(err) { + if let Some(msgbox_info) = LOGIN_ERROR_MAP.get(err) { + interface.msgbox( + msgbox_info.msgtype, + msgbox_info.title, + msgbox_info.text, + msgbox_info.link, + ); + msgbox_info.try_again + } else { + // unreachable! + false + } } else { if err.contains(SCRAP_X11_REQUIRED) { interface.msgbox("error", "Login Error", err, SCRAP_X11_REF_URL); diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index c1c38af40..ab8b76a7f 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -1256,6 +1256,7 @@ impl Remote { }, Some(message::Union::MessageBox(msgbox)) => { let mut link = msgbox.link; + // Links from remote side must be verified. if !link.starts_with("rustdesk://") { if let Some(v) = hbb_common::config::HELPER_URL.get(&link as &str) { link = v.to_string(); diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 146160fca..3dc8cdb12 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 3f562ebd4..b8df31c77 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "只允许密码访问"), ("Accept sessions via click", "只允许点击访问"), ("Accept sessions via both", "允许密码或点击访问"), - ("Please wait for the remote side to accept your session request...", "请等待对方接受你的连接..."), ("One-time Password", "一次性密码"), ("Use one-time password", "使用一次性密码"), ("One-time password length", "一次性密码长度"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", "记住此账户"), ("os_account_desk_tip", "在无显示器的环境下,此账户用于登录被控系统,并启用桌面"), ("OS Account", "系统账户"), + ("session_not_ready_title_tip", "桌面 session 未准备好"), + ("session_not_ready_text_tip", "请输入用户名密码"), + ("xsession_failed_title_tip", "用户名密码错误"), + ("xsession_failed_text_tip", "是否重试"), + ("another_user_login_title_tip", "其他用户已登录"), + ("another_user_login_text_tip", "断开"), + ("xorg_not_found_title_tip", "Xorg 未安装"), + ("xorg_not_found_text_tip", "请安装 Xorg"), + ("no_desktop_title_tip", "desktop 未安装"), + ("no_desktop_text_tip", "请安装 desktop"), + ("session_unready_no_password_title_tip", "桌面 session 未准备好"), + ("session_unready_no_password_text_tip", "请输入用户名密码和连接密码"), + ("session_unready_wrong_password_title_tip", "密码错误"), + ("session_unready_wrong_password_text_tip", "是否重试"), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index aa40f1442..020bea621 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 2737336c0..754b9671c 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Acceptér sessioner via adgangskode"), ("Accept sessions via click", "Acceptér sessioner via klik"), ("Accept sessions via both", "Acceptér sessioner via begge"), - ("Please wait for the remote side to accept your session request...", "Vent venligst på at fjernklienten accepterer din sessionsforespørgsel..."), ("One-time Password", "Engangskode"), ("Use one-time password", "Brug engangskode"), ("One-time password length", "Engangskode længde"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 6583c25e5..3d72a0242 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Sitzung mit Passwort bestätigen"), ("Accept sessions via click", "Sitzung mit einem Klick bestätigen"), ("Accept sessions via both", "Sitzung mit Klick und Passwort bestätigen"), - ("Please wait for the remote side to accept your session request...", "Bitte warten Sie, bis die Gegenseite Ihre Sitzungsanfrage akzeptiert hat …"), ("One-time Password", "Einmalpasswort"), ("Use one-time password", "Einmalpasswort verwenden"), ("One-time password length", "Länge des Einmalpassworts"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index fa0a3f990..b10d9f971 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Αποδοχή συνεδριών με κωδικό πρόσβασης"), ("Accept sessions via click", "Αποδοχή συνεδριών με κλικ"), ("Accept sessions via both", "Αποδοχή συνεδριών και με τα δύο"), - ("Please wait for the remote side to accept your session request...", "Παρακαλώ περιμένετε μέχρι η απομακρυσμένη πλευρά να αποδεχτεί το αίτημα συνεδρίας σας..."), ("One-time Password", "Κωδικός μίας χρήσης"), ("Use one-time password", "Χρήση κωδικού πρόσβασης μίας χρήσης"), ("One-time password length", "Μήκος κωδικού πρόσβασης μίας χρήσης"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/en.rs b/src/lang/en.rs index fede80eff..6035db7ba 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -60,5 +60,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("verify_rustdesk_password_tip", "Veryfy RustDesk password"), ("remember_account_tip", "Remember this account"), ("os_account_desk_tip", "This account is used to login the remote OS and enable the desktop session in headless"), + ("session_not_ready_title_tip", "Session is unready"), + ("session_not_ready_text_tip", "Input linux user/password"), + ("xsession_failed_title_tip", "Xsession username/password is wrong"), + ("xsession_failed_text_tip", "Do you want to enter again"), + ("another_user_login_title_tip", "Another user already login"), + ("another_user_login_text_tip", "Disconnect"), + ("xorg_not_found_title_tip", "Xorg not found"), + ("xorg_not_found_text_tip", "Please install Xorg"), + ("no_desktop_title_tip", "No desktop is avaliable"), + ("no_desktop_text_tip", "Please install GNOME desktop"), + ("session_unready_no_password_title_tip", "Session is unready"), + ("session_unready_no_password_text_tip", "Input connection password and linux user/password"), + ("session_unready_wrong_password_title_tip", "Password is wrong"), + ("session_unready_wrong_password_text_tip", "Do you want to enter again"), + ("no_password_access_text_tip", "Please wait for the remote side to accept your session request..."), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 0d8815588..3f2a0d573 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index a9d71dea5..9f06fff59 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Aceptar sesiones a través de contraseña"), ("Accept sessions via click", "Aceptar sesiones a través de clic"), ("Accept sessions via both", "Aceptar sesiones a través de ambos"), - ("Please wait for the remote side to accept your session request...", "Por favor, espere a que el lado remoto acepte su solicitud de sesión"), ("One-time Password", "Constaseña de un solo uso"), ("Use one-time password", "Usar contraseña de un solo uso"), ("One-time password length", "Longitud de la contraseña de un solo uso"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index f73bf3fec..1fad5bba1 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "قبول درخواست با رمز عبور"), ("Accept sessions via click", "قبول درخواست با کلیک موس"), ("Accept sessions via both", "قبول درخواست با هر دو"), - ("Please wait for the remote side to accept your session request...", "...لطفا صبر کنید تا میزبان درخواست شما را قبول کند"), ("One-time Password", "رمز عبور یکبار مصرف"), ("Use one-time password", "استفاده از رمز عبور یکبار مصرف"), ("One-time password length", "طول رمز عبور یکبار مصرف"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 3279b9175..58a65b3f4 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Accepter les sessions via mot de passe"), ("Accept sessions via click", "Accepter les sessions via clique de confirmation"), ("Accept sessions via both", "Accepter les sessions via mot de passe ou clique de confirmation"), - ("Please wait for the remote side to accept your session request...", "Veuillez attendre que votre demande de session distante soit accepter ..."), ("One-time Password", "Mot de passe unique"), ("Use one-time password", "Utiliser un mot de passe unique"), ("One-time password length", "Longueur du mot de passe unique"), diff --git a/src/lang/hu.rs b/src/lang/hu.rs index cfad983a2..5075802f1 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 3c0254f8d..4f87a926c 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Izinkan sesi dengan kata sandi"), ("Accept sessions via click", "Izinkan sesi dengan klik"), ("Accept sessions via both", "Izinkan sesi dengan keduanya"), - ("Please wait for the remote side to accept your session request...", "Harap tunggu sisi jarak jauh untuk menerima permintaan sesi Anda..."), ("One-time Password", "Kata sandi satu kali"), ("Use one-time password", "Gunakan kata sandi satu kali"), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index a09bfa97a..14a50ede9 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Accetta sessioni via password"), ("Accept sessions via click", "Accetta sessioni via click"), ("Accept sessions via both", "Accetta sessioni con entrambi"), - ("Please wait for the remote side to accept your session request...", "Attendere che il lato remoto accetti la richiesta di sessione..."), ("One-time Password", "Password monouso"), ("Use one-time password", "Usa password monouso"), ("One-time password length", "Lunghezza password monouso"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index ae153feac..e91137d8c 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 843211c49..c7c654632 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index b8d665a60..5422083bb 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index caaf80077..b043b8f7f 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Sessies accepteren via wachtwoord"), ("Accept sessions via click", "Sessies accepteren via klik"), ("Accept sessions via both", "Accepteer sessies via beide"), - ("Please wait for the remote side to accept your session request...", "Wacht tot de andere kant uw sessieverzoek accepteert..."), ("One-time Password", "Eenmalig Wachtwoord"), ("Use one-time password", "Gebruik een eenmalig Wachtwoord"), ("One-time password length", "Eenmalig Wachtwoord lengre"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index c1f2ef3dc..938a4e881 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Uwierzytelnij sesję używając hasła"), ("Accept sessions via click", "Uwierzytelnij sesję poprzez kliknięcie"), ("Accept sessions via both", "Uwierzytelnij sesję za pomocą obu sposobów"), - ("Please wait for the remote side to accept your session request...", "Oczekiwanie, na zatwierdzenie sesji przez host zdalny..."), ("One-time Password", "Hasło jednorazowe"), ("Use one-time password", "Użyj hasła jednorazowego"), ("One-time password length", "Długość hasła jednorazowego"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 880658ff4..ae4dbccba 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index fe7f4a36b..c9c0b84f7 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Aceitar sessões via senha"), ("Accept sessions via click", "Aceitar sessões via clique"), ("Accept sessions via both", "Aceitar sessões de ambos os modos"), - ("Please wait for the remote side to accept your session request...", "Por favor aguarde enquanto o cliente remoto aceita seu pedido de sessão..."), ("One-time Password", "Senha de uso único"), ("Use one-time password", "Usar senha de uso único"), ("One-time password length", "Comprimento da senha de uso único"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 046774f32..d6632d18a 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Acceptă sesiunile folosind parola"), ("Accept sessions via click", "Acceptă sesiunile cu un clic de confirmare"), ("Accept sessions via both", "Acceptă sesiunile folosind ambele moduri"), - ("Please wait for the remote side to accept your session request...", "Așteaptă ca solicitarea ta de conectare la distanță să fie acceptată..."), ("One-time Password", "Parolă unică"), ("Use one-time password", "Folosește parola unică"), ("One-time password length", "Lungimea parolei unice"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index ac87dcb48..a99523fca 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Принимать сеансы по паролю"), ("Accept sessions via click", "Принимать сеансы по нажатию"), ("Accept sessions via both", "Принимать сеансы по паролю+нажатию"), - ("Please wait for the remote side to accept your session request...", "Подождите, пока удалённая сторона примет ваш запрос на сеанс..."), ("One-time Password", "Одноразовый пароль"), ("Use one-time password", "Использовать одноразовый пароль"), ("One-time password length", "Длина одноразового пароля"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 1a156d8a6..7a8b9a778 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 1f07b027c..581507457 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Sprejmi seje z geslom"), ("Accept sessions via click", "Sprejmi seje s potrditvijo"), ("Accept sessions via both", "Sprejmi seje z geslom ali potrditvijo"), - ("Please wait for the remote side to accept your session request...", "Počakajte, da oddaljeni računalnik sprejme povezavo..."), ("One-time Password", "Enkratno geslo"), ("Use one-time password", "Uporabi enkratno geslo"), ("One-time password length", "Dolžina enkratnega gesla"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index 558984a1b..eb1b50762 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Prano sesionin nëpërmjet fjalëkalimit"), ("Accept sessions via click", "Prano sesionet nëpërmjet klikimit"), ("Accept sessions via both", "Prano sesionet nëpërmjet të dyjave"), - ("Please wait for the remote side to accept your session request...", "Ju lutem prisni që ana në distancë të pranoj kërkësen tuaj"), ("One-time Password", "Fjalëkalim Një-herë"), ("Use one-time password", "Përdorni fjalëkalim Një-herë"), ("One-time password length", "Gjatësia e fjalëkalimit një herë"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 3ec1d32d1..260eadc24 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Prihvati sesije preko lozinke"), ("Accept sessions via click", "Prihvati sesije preko klika"), ("Accept sessions via both", "Prihvati sesije preko oboje"), - ("Please wait for the remote side to accept your session request...", "Molimo sačekajte da udaljena strana prihvati vaš zahtev za sesijom..."), ("One-time Password", "Jednokratna lozinka"), ("Use one-time password", "Koristi jednokratnu lozinku"), ("One-time password length", "Dužina jednokratne lozinke"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 93bbaf74e..9db56dcc9 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Acceptera sessioner via lösenord"), ("Accept sessions via click", "Acceptera sessioner via klick"), ("Accept sessions via both", "Acceptera sessioner via båda"), - ("Please wait for the remote side to accept your session request...", "Var god vänta på att klienten accepterar din förfrågan..."), ("One-time Password", "En-gångs lösenord"), ("Use one-time password", "Använd en-gångs lösenord"), ("One-time password length", "Längd på en-gångs lösenord"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index db1519e9d..ac4413201 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 1b41ff694..11260f440 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "ยอมรับการเชื่อมต่อด้วยรหัสผ่าน"), ("Accept sessions via click", "ยอมรับการเชื่อมต่อด้วยการคลิก"), ("Accept sessions via both", "ยอมรับการเชื่อมต่อด้วยทั้งสองวิธิ"), - ("Please wait for the remote side to accept your session request...", "กรุณารอให้อีกฝั่งยอมรับการเชื่อมต่อของคุณ..."), ("One-time Password", "รหัสผ่านครั้งเดียว"), ("Use one-time password", "ใช้รหัสผ่านครั้งเดียว"), ("One-time password length", "ความยาวรหัสผ่านครั้งเดียว"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 0aa49a3e4..b76484b33 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Oturumları parola ile kabul etme"), ("Accept sessions via click", "Tıklama yoluyla oturumları kabul edin"), ("Accept sessions via both", "Her ikisi aracılığıyla oturumları kabul edin"), - ("Please wait for the remote side to accept your session request...", "Lütfen uzak tarafın oturum isteğinizi kabul etmesini bekleyin..."), ("One-time Password", "Tek Kullanımlık Şifre"), ("Use one-time password", "Tek seferlik parola kullanın"), ("One-time password length", "Tek seferlik şifre uzunluğu"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 0077fdaad..f77014e8f 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "只允許透過輸入密碼進行連線"), ("Accept sessions via click", "只允許透過點擊接受進行連線"), ("Accept sessions via both", "允許輸入密碼或點擊接受進行連線"), - ("Please wait for the remote side to accept your session request...", "請等待對方接受您的連線請求 ..."), ("One-time Password", "一次性密碼"), ("Use one-time password", "使用一次性密碼"), ("One-time password length", "一次性密碼長度"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 811bcd913..873dad281 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", "Підтверджувати сеанси паролем"), ("Accept sessions via click", "Підтверджувати сеанси натисканням"), ("Accept sessions via both", "Підтверджувати сеанси обома способами"), - ("Please wait for the remote side to accept your session request...", "Буль ласка, зачекайте, поки віддалена сторона підтвердить запит на сеанс..."), ("One-time Password", "Одноразовий пароль"), ("Use one-time password", "Використати одноразовий пароль"), ("One-time password length", "Довжина одноразового пароля"), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 6ad03f0f8..7756b8894 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -402,7 +402,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Accept sessions via password", ""), ("Accept sessions via click", ""), ("Accept sessions via both", ""), - ("Please wait for the remote side to accept your session request...", ""), ("One-time Password", ""), ("Use one-time password", ""), ("One-time password length", ""), @@ -485,5 +484,20 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("remember_account_tip", ""), ("os_account_desk_tip", ""), ("OS Account", ""), + ("session_not_ready_title_tip", ""), + ("session_not_ready_text_tip", ""), + ("xsession_failed_title_tip", ""), + ("xsession_failed_text_tip", ""), + ("another_user_login_title_tip", ""), + ("another_user_login_text_tip", ""), + ("xorg_not_found_title_tip", ""), + ("xorg_not_found_text_tip", ""), + ("no_desktop_title_tip", ""), + ("no_desktop_text_tip", ""), + ("session_unready_no_password_title_tip", ""), + ("session_unready_no_password_text_tip", ""), + ("session_unready_wrong_password_title_tip", ""), + ("session_unready_wrong_password_text_tip", ""), + ("no_password_access_text_tip", ""), ].iter().cloned().collect(); } diff --git a/src/platform/linux_desktop_manager.rs b/src/platform/linux_desktop_manager.rs index 3a72f8976..e9dc00ef6 100644 --- a/src/platform/linux_desktop_manager.rs +++ b/src/platform/linux_desktop_manager.rs @@ -1,4 +1,9 @@ use super::{linux::*, ResultType}; +use crate::server::{ + LOGIN_MSG_DESKTOP_NO_DESKTOP, LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER, + LOGIN_MSG_DESKTOP_SESSION_NOT_READY, LOGIN_MSG_DESKTOP_XORG_NOT_FOUND, + LOGIN_MSG_DESKTOP_XSESSION_FAILED, +}; use hbb_common::{allow_err, bail, log, rand::prelude::*, tokio::time}; use pam; use std::{ @@ -59,7 +64,65 @@ pub fn stop_xdesktop() { *DESKTOP_MANAGER.lock().unwrap() = None; } -pub fn try_start_x_session(username: &str, password: &str) -> ResultType<(String, bool)> { +pub fn try_start_desktop(_username: &str, _passsword: &str) -> String { + if _username.is_empty() { + let username = get_username(); + if username.is_empty() { + LOGIN_MSG_DESKTOP_SESSION_NOT_READY + } else { + "" + } + .to_owned() + } else { + let username = get_username(); + if username == _username { + // No need to verify password here. + return "".to_owned(); + } + + match run_cmds(&format!("which {}", DesktopManager::get_xorg())) { + Ok(output) => { + if output.trim().is_empty() { + return LOGIN_MSG_DESKTOP_XORG_NOT_FOUND.to_owned(); + } + } + _ => { + return LOGIN_MSG_DESKTOP_XORG_NOT_FOUND.to_owned(); + } + } + + match run_cmds("ls /usr/share/xsessions/") { + Ok(output) => { + if output.trim().is_empty() { + return LOGIN_MSG_DESKTOP_NO_DESKTOP.to_owned(); + } + } + _ => { + return LOGIN_MSG_DESKTOP_NO_DESKTOP.to_owned(); + } + } + + match try_start_x_session(_username, _passsword) { + Ok((username, x11_ready)) => { + if x11_ready { + if _username != username { + LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER.to_owned() + } else { + "".to_owned() + } + } else { + LOGIN_MSG_DESKTOP_SESSION_NOT_READY.to_owned() + } + } + Err(e) => { + log::error!("Failed to start xsession {}", e); + LOGIN_MSG_DESKTOP_XSESSION_FAILED.to_owned() + } + } + } +} + +fn try_start_x_session(username: &str, password: &str) -> ResultType<(String, bool)> { let mut desktop_manager = DESKTOP_MANAGER.lock().unwrap(); if let Some(desktop_manager) = &mut (*desktop_manager) { if let Some(seat0_username) = desktop_manager.get_supported_display_seat0_username() { @@ -547,36 +610,36 @@ impl DesktopManager { } } - fn get_xorg() -> ResultType<&'static str> { + fn get_xorg() -> &'static str { // Fedora 26 or later let xorg = "/usr/libexec/Xorg"; if Path::new(xorg).is_file() { - return Ok(xorg); + return xorg; } // Debian 9 or later let xorg = "/usr/lib/xorg/Xorg"; if Path::new(xorg).is_file() { - return Ok(xorg); + return xorg; } // Ubuntu 16.04 or later let xorg = "/usr/lib/xorg/Xorg"; if Path::new(xorg).is_file() { - return Ok(xorg); + return xorg; } // Arch Linux let xorg = "/usr/lib/xorg-server/Xorg"; if Path::new(xorg).is_file() { - return Ok(xorg); + return xorg; } // Arch Linux let xorg = "/usr/lib/Xorg"; if Path::new(xorg).is_file() { - return Ok(xorg); + return xorg; } // CentOS 7 /usr/bin/Xorg or param=Xorg log::warn!("Failed to find xorg, use default Xorg.\n Please add \"allowed_users=anybody\" to \"/etc/X11/Xwrapper.config\"."); - Ok("Xorg") + "Xorg" } fn start_x_server( @@ -586,7 +649,7 @@ impl DesktopManager { gid: u32, envs: &HashMap<&str, String>, ) -> ResultType { - let xorg = Self::get_xorg()?; + let xorg = Self::get_xorg(); log::info!("Use xorg: {}", &xorg); match Command::new(xorg) .envs(envs) diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 7c9b2f0b0..fc27be098 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -17,7 +17,7 @@ pub mod delegate; #[cfg(target_os = "linux")] pub mod linux; -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", feature = "linux_headless"))] pub mod linux_desktop_manager; #[cfg(not(any(target_os = "android", target_os = "ios")))] diff --git a/src/rendezvous_mediator.rs b/src/rendezvous_mediator.rs index 3fef9747b..cc93dbb45 100644 --- a/src/rendezvous_mediator.rs +++ b/src/rendezvous_mediator.rs @@ -72,7 +72,7 @@ impl RendezvousMediator { allow_err!(super::lan::start_listening()); }); } - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] crate::platform::linux_desktop_manager::start_xdesktop(); SHOULD_EXIT.store(false, Ordering::SeqCst); while !SHOULD_EXIT.load(Ordering::SeqCst) { @@ -99,7 +99,7 @@ impl RendezvousMediator { } sleep(1.).await; } - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] crate::platform::linux_desktop_manager::stop_xdesktop(); } diff --git a/src/server/connection.rs b/src/server/connection.rs index 65a3fd025..b442ff899 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -3,7 +3,7 @@ use super::{input_service::*, *}; use crate::clipboard_file::*; #[cfg(not(any(target_os = "android", target_os = "ios")))] use crate::common::update_clipboard; -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", feature = "linux_headless"))] use crate::platform::linux_desktop_manager; #[cfg(windows)] use crate::portable_service::client as portable_client; @@ -18,7 +18,7 @@ use crate::{ use crate::{common::DEVICE_NAME, flutter::connection_manager::start_channel}; use crate::{ipc, VERSION}; use cidr_utils::cidr::IpCidr; -#[cfg(all(target_os = "linux", feature = "flutter"))] +#[cfg(all(target_os = "linux", feature = "linux_headless"))] use hbb_common::platform::linux::run_cmds; use hbb_common::{ config::Config, @@ -65,12 +65,16 @@ pub const LOGIN_MSG_DESKTOP_NOT_INITED: &str = "Desktop env is not inited"; pub const LOGIN_MSG_DESKTOP_SESSION_NOT_READY: &str = "Desktop session unready"; pub const LOGIN_MSG_DESKTOP_XSESSION_FAILED: &str = "Desktop xsession failed"; pub const LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER: &str = "Desktop session another user login"; +pub const LOGIN_MSG_DESKTOP_XORG_NOT_FOUND: &str = "Desktop xorg not found"; +// ls /usr/share/xsessions/ +pub const LOGIN_MSG_DESKTOP_NO_DESKTOP: &str = "Desktop none"; pub const LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY: &str = "Desktop session unready, password empty"; pub const LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG: &str = "Desktop session unready, password wrong"; pub const LOGIN_MSG_PASSWORD_EMPTY: &str = "Empty Password"; 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"; #[derive(Clone, Default)] @@ -150,9 +154,9 @@ pub struct Connection { audio_input_device_before_voice_call: Option, options_in_login: Option, pressed_modifiers: HashSet, - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] rx_cm_stream_ready: mpsc::Receiver<()>, - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] tx_desktop_ready: mpsc::Sender<()>, } @@ -270,9 +274,9 @@ impl Connection { audio_input_device_before_voice_call: None, options_in_login: None, pressed_modifiers: Default::default(), - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] rx_cm_stream_ready: _rx_cm_stream_ready, - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] tx_desktop_ready: _tx_desktop_ready, }; #[cfg(not(any(target_os = "android", target_os = "ios")))] @@ -886,6 +890,7 @@ impl Connection { if crate::platform::current_is_wayland() { platform_additions.insert("is_wayland".into(), json!(true)); } + #[cfg(feature = "linux_headless")] if linux_desktop_manager::is_headless() { platform_additions.insert("headless".into(), json!(true)); } @@ -1096,45 +1101,6 @@ impl Connection { self.tx_input.send(MessageInput::Key((msg, press))).ok(); } - fn try_start_desktop(_username: &str, _passsword: &str) -> String { - #[cfg(target_os = "linux")] - if _username.is_empty() { - let username = linux_desktop_manager::get_username(); - if username.is_empty() { - LOGIN_MSG_DESKTOP_SESSION_NOT_READY - } else { - "" - } - .to_owned() - } else { - let username = linux_desktop_manager::get_username(); - if username == _username { - // No need to verify password here. - return "".to_owned(); - } - - match linux_desktop_manager::try_start_x_session(_username, _passsword) { - Ok((username, x11_ready)) => { - if x11_ready { - if _username != username { - LOGIN_MSG_DESKTOP_SESSION_ANOTHER_USER.to_owned() - } else { - "".to_owned() - } - } else { - LOGIN_MSG_DESKTOP_SESSION_NOT_READY.to_owned() - } - } - Err(e) => { - log::error!("Failed to start xsession {}", e); - LOGIN_MSG_DESKTOP_XSESSION_FAILED.to_owned() - } - } - } - #[cfg(not(target_os = "linux"))] - "".to_owned() - } - fn validate_one_password(&self, password: String) -> bool { if password.len() == 0 { return false; @@ -1300,16 +1266,20 @@ impl Connection { _ => {} } + #[cfg(all(target_os = "linux", feature = "linux_headless"))] let desktop_err = match lr.os_login.as_ref() { - Some(os_login) => Self::try_start_desktop(&os_login.username, &os_login.password), - None => Self::try_start_desktop("", ""), + Some(os_login) => { + linux_desktop_manager::try_start_desktop(&os_login.username, &os_login.password) + } + None => linux_desktop_manager::try_start_desktop("", ""), }; - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] let is_headless = linux_desktop_manager::is_headless(); - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] let wait_ipc_timeout = 10_000; // If err is LOGIN_MSG_DESKTOP_SESSION_NOT_READY, just keep this msg and go on checking password. + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if !desktop_err.is_empty() && desktop_err != LOGIN_MSG_DESKTOP_SESSION_NOT_READY { self.send_login_error(desktop_err).await; return true; @@ -1324,7 +1294,7 @@ impl Connection { if hbb_common::get_version_number(&lr.version) >= hbb_common::get_version_number("1.2.0") { - self.send_login_error("No Password Access").await; + self.send_login_error(LOGIN_MSG_NO_PASSWORD_ACCESS).await; } return true; } else if password::approve_mode() == ApproveMode::Password @@ -1333,6 +1303,7 @@ impl Connection { self.send_login_error("Connection not allowed").await; return false; } else if self.is_recent_session() { + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if desktop_err.is_empty() { #[cfg(target_os = "linux")] if is_headless { @@ -1347,13 +1318,24 @@ impl Connection { } else { self.send_login_error(desktop_err).await; } + #[cfg(not(all(target_os = "linux", feature = "linux_headless")))] + { + self.try_start_cm(lr.my_id, lr.my_name, true); + self.send_logon_response().await; + if self.port_forward_socket.is_some() { + return false; + } + } } else if lr.password.is_empty() { + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if desktop_err.is_empty() { self.try_start_cm(lr.my_id, lr.my_name, false); } else { self.send_login_error(LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_EMPTY) .await; } + #[cfg(not(all(target_os = "linux", feature = "linux_headless")))] + self.try_start_cm(lr.my_id, lr.my_name, false); } else { let mut failure = LOGIN_FAILURES .lock() @@ -1394,6 +1376,7 @@ impl Connection { .lock() .unwrap() .insert(self.ip.clone(), failure); + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if desktop_err.is_empty() { self.send_login_error(LOGIN_MSG_PASSWORD_WRONG).await; self.try_start_cm(lr.my_id, lr.my_name, false); @@ -1401,10 +1384,16 @@ impl Connection { self.send_login_error(LOGIN_MSG_DESKTOP_SESSION_NOT_READY_PASSWORD_WRONG) .await; } + #[cfg(not(all(target_os = "linux", feature = "linux_headless")))] + { + self.send_login_error(LOGIN_MSG_PASSWORD_WRONG).await; + self.try_start_cm(lr.my_id, lr.my_name, false); + } } else { if failure.0 != 0 { LOGIN_FAILURES.lock().unwrap().remove(&self.ip); } + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if desktop_err.is_empty() { #[cfg(target_os = "linux")] if is_headless { @@ -1420,6 +1409,14 @@ impl Connection { } else { self.send_login_error(desktop_err).await; } + #[cfg(not(all(target_os = "linux", feature = "linux_headless")))] + { + self.send_logon_response().await; + self.try_start_cm(lr.my_id, lr.my_name, true); + if self.port_forward_socket.is_some() { + return false; + } + } } } } else if let Some(message::Union::TestDelay(t)) = msg.union { @@ -2207,11 +2204,13 @@ async fn start_ipc( args.push("--hide"); }; - #[cfg(all(target_os = "linux", not(feature = "flutter")))] + #[cfg(target_os = "linux")] + #[cfg(not(feature = "linux_headless"))] let user = None; - #[cfg(all(target_os = "linux", feature = "flutter"))] + #[cfg(all(target_os = "linux", feature = "linux_headless"))] let mut user = None; - #[cfg(all(target_os = "linux", feature = "flutter"))] + // Cm run as user, wait until desktop session is ready. + #[cfg(all(target_os = "linux", feature = "linux_headless"))] if linux_desktop_manager::is_headless() { let mut username = linux_desktop_manager::get_username(); loop {