mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
1. fix get_api_server.
2. add device info in LoginRequest
This commit is contained in:
@@ -451,6 +451,7 @@ pub fn run_me<T: AsRef<std::ffi::OsStr>>(args: Vec<T>) -> std::io::Result<std::p
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn username() -> String {
|
||||
// fix bug of whoami
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
@@ -459,6 +460,14 @@ pub fn username() -> String {
|
||||
return DEVICE_NAME.lock().unwrap().clone();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn hostname() -> String {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
return whoami::hostname();
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return DEVICE_NAME.lock().unwrap().clone();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn check_port<T: std::string::ToString>(host: T, port: i32) -> String {
|
||||
hbb_common::socket_client::check_port(host, port)
|
||||
@@ -581,9 +590,9 @@ pub fn get_api_server(api: String, custom: String) -> String {
|
||||
if !s0.is_empty() {
|
||||
let s = crate::increase_port(&s0, -2);
|
||||
if s == s0 {
|
||||
format!("http://{}:{}", s, config::RENDEZVOUS_PORT - 2);
|
||||
return format!("http://{}:{}", s, config::RENDEZVOUS_PORT - 2);
|
||||
} else {
|
||||
format!("http://{}", s);
|
||||
return format!("http://{}", s);
|
||||
}
|
||||
}
|
||||
"https://admin.rustdesk.com".to_owned()
|
||||
|
||||
@@ -523,6 +523,10 @@ pub fn main_get_sound_inputs() -> Vec<String> {
|
||||
vec![String::from("")]
|
||||
}
|
||||
|
||||
pub fn main_get_hostname() -> SyncReturn<String> {
|
||||
SyncReturn(crate::common::hostname())
|
||||
}
|
||||
|
||||
pub fn main_change_id(new_id: String) {
|
||||
change_id(new_id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user