Merge master

This commit is contained in:
csf
2022-08-04 17:24:02 +08:00
parent 07debe8363
commit 3ff2f60fb7
27 changed files with 1015 additions and 281 deletions

View File

@@ -644,25 +644,6 @@ unsafe extern "C" fn get_by_name(name: *const c_char, arg: *const c_char) -> *co
// res = Session::get_option(arg);
// }
// }
"server_id" => {
res = ui_interface::get_id();
}
"temporary_password" => {
res = ui_interface::temporary_password();
}
"permanent_password" => {
res = ui_interface::permanent_password();
}
"connect_statue" => {
res = ONLINE
.lock()
.unwrap()
.values()
.max()
.unwrap_or(&0)
.clone()
.to_string();
}
// File Action
"get_home_dir" => {
res = fs::get_home_as_string();
@@ -683,6 +664,33 @@ unsafe extern "C" fn get_by_name(name: *const c_char, arg: *const c_char) -> *co
// }
// }
// Server Side
"local_option" => {
if let Ok(arg) = arg.to_str() {
res = LocalConfig::get_option(arg);
}
}
"langs" => {
res = crate::lang::LANGS.to_string();
}
"server_id" => {
res = ui_interface::get_id();
}
"temporary_password" => {
res = ui_interface::temporary_password();
}
"permanent_password" => {
res = ui_interface::permanent_password();
}
"connect_statue" => {
res = ONLINE
.lock()
.unwrap()
.values()
.max()
.unwrap_or(&0)
.clone()
.to_string();
}
#[cfg(not(any(target_os = "ios")))]
"clients_state" => {
res = get_clients_state();
@@ -862,9 +870,22 @@ unsafe extern "C" fn set_by_name(name: *const c_char, value: *const c_char) {
// }
// }
// }
"local_option" => {
if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(value) {
if let Some(name) = m.get("name") {
if let Some(value) = m.get("value") {
LocalConfig::set_option(name.to_owned(), value.to_owned());
}
}
}
}
// "input_os_password" => {
// Session::input_os_password(value.to_owned(), true);
// }
"restart_remote_device" => {
// TODO
// Session::restart_remote_device();
}
// // File Action
// "read_remote_dir" => {
// if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(value) {