diff --git a/Cargo.lock b/Cargo.lock index 45f809680..299d99c14 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5133,6 +5133,7 @@ dependencies = [ "include_dir", "jni 0.19.0", "lazy_static", + "libloading", "libpulse-binding", "libpulse-simple-binding", "mac_address", diff --git a/Cargo.toml b/Cargo.toml index d70c202c6..784b83537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,7 @@ hex = "0.4" reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"], default-features=false } chrono = "0.4" cidr-utils = "0.5" +libloading = "0.7" [target.'cfg(not(any(target_os = "android", target_os = "linux")))'.dependencies] cpal = "0.15" diff --git a/src/client.rs b/src/client.rs index 1dd525984..1c6f12108 100644 --- a/src/client.rs +++ b/src/client.rs @@ -53,9 +53,7 @@ use scrap::{ ImageFormat, }; -use crate::{ - common::{self, is_keyboard_mode_supported}, -}; +use crate::common::{self, is_keyboard_mode_supported}; #[cfg(not(any(target_os = "android", target_os = "ios")))] use crate::common::{check_clipboard, ClipboardContext, CLIPBOARD_INTERVAL}; @@ -73,6 +71,8 @@ pub const MILLI1: Duration = Duration::from_millis(1); pub const SEC30: Duration = Duration::from_secs(30); pub const VIDEO_QUEUE_SIZE: usize = 120; +#[cfg(all(target_os = "linux", feature = "linux_headless"))] +#[cfg(not(any(feature = "flatpak", feature = "appimage")))] pub const LOGIN_MSG_DESKTOP_NOT_INITED: &str = "Desktop env is not inited"; pub const LOGIN_MSG_DESKTOP_SESSION_NOT_READY: &str = "Desktop session not ready"; pub const LOGIN_MSG_DESKTOP_XSESSION_FAILED: &str = "Desktop xsession failed"; @@ -88,7 +88,9 @@ 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"; +#[cfg(target_os = "linux")] pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version."; +#[cfg(target_os = "linux")] pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str = "Wayland requires higher version of linux distro. Please try X11 desktop or change your OS."; pub const SCRAP_X11_REQUIRED: &str = "x11 expected"; diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index 919347e5f..eccc837f0 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -362,7 +362,10 @@ impl Remote { }); return Some(tx); } - None + #[cfg(target_os = "ios")] + { + None + } } async fn handle_msg_from_ui(&mut self, data: Data, peer: &mut Stream) -> bool { diff --git a/src/lib.rs b/src/lib.rs index ad9229ab5..ec70d1179 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,6 @@ mod license; #[cfg(not(any(target_os = "android", target_os = "ios")))] mod port_forward; -#[cfg(all(feature = "flutter", feature = "plugin_framework"))] #[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(any(feature = "flutter"))] pub mod api; @@ -56,6 +55,10 @@ pub mod api; #[cfg(any(feature = "flutter"))] pub mod plugins; +#[cfg(all(feature = "flutter", feature = "plugin_framework"))] +#[cfg(not(any(target_os = "android", target_os = "ios")))] +pub mod plugin; + mod tray; mod ui_cm_interface; diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 2747a6f00..779119221 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -14,10 +14,12 @@ use rdev::{Event, EventType::*, KeyCode}; use uuid::Uuid; use hbb_common::config::{Config, LocalConfig, PeerConfig}; +#[cfg(not(feature = "flutter"))] +use hbb_common::fs; use hbb_common::rendezvous_proto::ConnType; use hbb_common::tokio::{self, sync::mpsc}; use hbb_common::{allow_err, message_proto::*}; -use hbb_common::{fs, get_version_number, log, Stream}; +use hbb_common::{get_version_number, log, Stream}; use crate::client::io_loop::Remote; use crate::client::{ @@ -25,7 +27,7 @@ use crate::client::{ input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key, LoginConfigHandler, QualityStatus, KEY_MAP, }; -use crate::common::{self, GrabState}; +use crate::common::GrabState; use crate::keyboard; use crate::{client::Data, client::Interface}; @@ -155,6 +157,7 @@ impl Session { self.lc.read().unwrap().get_toggle_option(&name) } + #[cfg(not(feature = "flutter"))] pub fn is_privacy_mode_supported(&self) -> bool { self.lc.read().unwrap().is_privacy_mode_supported() } @@ -198,6 +201,7 @@ impl Session { self.lc.read().unwrap().remember } + #[cfg(not(feature = "flutter"))] pub fn set_write_override( &mut self, job_id: i32, @@ -240,6 +244,8 @@ impl Session { self.send(Data::Message(msg)); } + #[cfg(all(feature = "flutter", feature = "plugin_framework"))] + #[cfg(not(any(target_os = "android", target_os = "ios")))] pub fn send_plugin(&self, plugin: Plugin) { let mut misc = Misc::new(); misc.set_plugin(plugin); @@ -270,6 +276,8 @@ impl Session { }); } + #[cfg(not(feature = "flutter"))] + #[cfg(not(any(target_os = "android", target_os = "ios")))] pub fn is_xfce(&self) -> bool { #[cfg(not(any(target_os = "ios")))] return crate::platform::is_xfce(); @@ -277,11 +285,6 @@ impl Session { false } - pub fn get_supported_keyboard_modes(&self) -> Vec { - let version = self.get_peer_version(); - common::get_supported_keyboard_modes(version) - } - pub fn remove_port_forward(&self, port: i32) { let mut config = self.load_config(); config.port_forwards = config @@ -310,6 +313,7 @@ impl Session { self.send(Data::AddPortForward(pf)); } + #[cfg(not(feature = "flutter"))] pub fn get_id(&self) -> String { self.id.clone() } @@ -369,6 +373,7 @@ impl Session { input_os_password(pass, activate, self.clone()); } + #[cfg(not(feature = "flutter"))] pub fn get_chatbox(&self) -> String { #[cfg(feature = "inline")] return crate::ui::inline::get_chatbox(); @@ -545,7 +550,8 @@ impl Session { position_code: i32, lock_modes: i32, down_or_up: bool, - ) {} + ) { + } #[cfg(not(any(target_os = "ios")))] pub fn handle_flutter_key_event( @@ -675,6 +681,7 @@ impl Session { })); } + #[cfg(not(feature = "flutter"))] pub fn get_icon_path(&self, file_type: i32, ext: String) -> String { let mut path = Config::icon_path(); if file_type == FileType::DirLink as i32 {