Merge branch 'master' into record

This commit is contained in:
RustDesk
2022-09-27 15:32:27 +08:00
committed by GitHub
76 changed files with 1734 additions and 1072 deletions

View File

@@ -15,18 +15,7 @@ use hbb_common::{message_proto::Hash, ResultType};
use crate::flutter::{self, SESSIONS};
use crate::start_server;
use crate::ui_interface;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::ui_interface::get_sound_inputs;
use crate::ui_interface::{
change_id, check_mouse_time, check_super_user_permission, default_video_save_directory,
discover, forget_password, get_api_server, get_app_name, get_async_job_status,
get_connect_status, get_fav, get_id, get_lan_peers, get_langs, get_license, get_local_option,
get_mouse_time, get_option, get_options, get_peer, get_peer_option, get_socks, get_uuid,
get_version, has_hwcodec, has_rendezvous_service, post_request, send_to_cm, set_local_option,
set_option, set_options, set_peer_option, set_permanent_password, set_socks, store_fav,
test_if_valid_server, update_temporary_password, using_public_server,
};
use crate::ui_interface::{self, *};
use crate::{
client::file_trait::FileManager,
flutter::{make_fd_to_json, session_add, session_start_},
@@ -482,6 +471,9 @@ pub fn main_get_app_name() -> String {
get_app_name()
}
pub fn main_get_app_name_sync() -> SyncReturn<String> {
SyncReturn(get_app_name())
}
pub fn main_get_license() -> String {
get_license()
}
@@ -563,14 +555,27 @@ pub fn main_get_peer_option(id: String, key: String) -> String {
get_peer_option(id, key)
}
pub fn main_get_peer_option_sync(id: String, key: String) -> SyncReturn<String> {
SyncReturn(get_peer_option(id, key))
}
pub fn main_set_peer_option(id: String, key: String, value: String) {
set_peer_option(id, key, value)
}
pub fn main_set_peer_option_sync(id: String, key: String, value: String) -> SyncReturn<bool> {
set_peer_option(id, key, value);
SyncReturn(true)
}
pub fn main_forget_password(id: String) {
forget_password(id)
}
pub fn main_peer_has_password(id: String) -> bool {
peer_has_password(id)
}
pub fn main_get_recent_peers() -> String {
if !config::APP_DIR.read().unwrap().is_empty() {
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers()
@@ -699,10 +704,7 @@ fn main_broadcast_message(data: &HashMap<&str, &str>) {
}
pub fn main_change_theme(dark: String) {
main_broadcast_message(&HashMap::from([
("name", "theme"),
("dark", &dark),
]));
main_broadcast_message(&HashMap::from([("name", "theme"), ("dark", &dark)]));
send_to_cm(&crate::ipc::Data::Theme(dark));
}
@@ -982,6 +984,48 @@ pub fn query_onlines(ids: Vec<String>) {
crate::rendezvous_mediator::query_online_states(ids, handle_query_onlines)
}
pub fn main_is_installed() -> SyncReturn<bool> {
SyncReturn(is_installed())
}
pub fn main_is_installed_lower_version() -> SyncReturn<bool> {
SyncReturn(is_installed_lower_version())
}
pub fn main_is_installed_daemon(prompt: bool) -> SyncReturn<bool> {
SyncReturn(is_installed_daemon(prompt))
}
pub fn main_is_process_trusted(prompt: bool) -> SyncReturn<bool> {
SyncReturn(is_process_trusted(prompt))
}
pub fn main_is_can_screen_recording(prompt: bool) -> SyncReturn<bool> {
SyncReturn(is_can_screen_recording(prompt))
}
pub fn main_is_share_rdp() -> SyncReturn<bool> {
SyncReturn(is_share_rdp())
}
pub fn main_is_rdp_service_open() -> SyncReturn<bool> {
SyncReturn(is_rdp_service_open())
}
pub fn main_goto_install() -> SyncReturn<bool> {
goto_install();
SyncReturn(true)
}
pub fn main_get_new_version() -> SyncReturn<String> {
SyncReturn(get_new_version())
}
pub fn main_update_me() -> SyncReturn<bool> {
update_me("".to_owned());
SyncReturn(true)
}
#[cfg(target_os = "android")]
pub mod server_side {
use jni::{