mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
refact, option, allow linux headless
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -9,6 +9,9 @@ use hbb_common::{
|
||||
message_proto::Resolution,
|
||||
regex::{Captures, Regex},
|
||||
};
|
||||
#[cfg(all(feature = "linux_headless"))]
|
||||
#[cfg(not(any(feature = "flatpak", feature = "appimage")))]
|
||||
use hbb_common::config::CONFIG_OPTION_ALLOW_LINUX_HEADLESS;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
io::Write,
|
||||
@@ -69,6 +72,13 @@ pub struct xcb_xfixes_get_cursor_image {
|
||||
pub pixels: *const c_long,
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(feature = "linux_headless")]
|
||||
#[cfg(not(any(feature = "flatpak", feature = "appimage")))]
|
||||
pub fn is_headless_allowed() -> bool {
|
||||
Config::get_option(CONFIG_OPTION_ALLOW_LINUX_HEADLESS) == "Y"
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn sleep_millis(millis: u64) {
|
||||
std::thread::sleep(Duration::from_millis(millis));
|
||||
|
||||
@@ -109,6 +109,10 @@ pub fn try_start_desktop(_username: &str, _passsword: &str) -> String {
|
||||
// No need to verify password here.
|
||||
return "".to_owned();
|
||||
}
|
||||
if username.is_empty() {
|
||||
// Another user is logged in. No need to start a new xsession.
|
||||
return "".to_owned();
|
||||
}
|
||||
|
||||
if let Some(msg) = detect_headless() {
|
||||
return msg.to_owned();
|
||||
|
||||
Reference in New Issue
Block a user