Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

cm get config

21pages1902134f0398
diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart
index 3c8b5878d..3322291eb 100644
--- a/flutter/lib/desktop/pages/desktop_setting_page.dart
+++ b/flutter/lib/desktop/pages/desktop_setting_page.dart
@@ -1319,7 +1319,7 @@ class _DisplayState extends State<_Display> {
otherRow('Zoom cursor', 'zoom-cursor'),
otherRow('Show quality monitor', 'show_quality_monitor'),
otherRow('Mute', 'disable_audio'),
- otherRow('Allow file copy and paste', 'enable_file_transfer'),
+ otherRow('Enable file copy and paste', 'enable_file_transfer'),
otherRow('Disable clipboard', 'disable_clipboard'),
otherRow('Lock after session end', 'lock_after_session_end'),
otherRow('Privacy mode', 'privacy_mode'),
diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart
index b8a7a8e45..7e793a776 100644
--- a/flutter/lib/main.dart
+++ b/flutter/lib/main.dart
@@ -91,7 +91,7 @@ Future<void> main(List<String> args) async {
debugPrint("--cm started");
desktopType = DesktopType.cm;
await windowManager.ensureInitialized();
- runConnectionManagerScreen(args.contains('--hide'));
+ runConnectionManagerScreen();
} else if (args.contains('--install')) {
runInstallPage();
} else {
@@ -225,13 +225,14 @@ void runMultiWindow(
WindowController.fromWindowId(kWindowId!).show();
}
-void runConnectionManagerScreen(bool hide) async {
+void runConnectionManagerScreen() async {
await initEnv(kAppTypeConnectionManager);
_runApp(
'',
const DesktopServerPage(),
MyTheme.currentThemeMode(),
);
+ final hide = await bind.cmGetConfig(name: "hide_cm") == 'true';
gFFI.serverModel.hideCm = hide;
if (hide) {
await hideCmWindow(isStartup: true);
diff --git a/flutter/lib/models/server_model.dart b/flutter/lib/models/server_model.dart
index 1422596c2..72013fd0b 100644
--- a/flutter/lib/models/server_model.dart
+++ b/flutter/lib/models/server_model.dart
@@ -79,10 +79,12 @@ class ServerModel with ChangeNotifier {
setVerificationMethod(String method) async {
await bind.mainSetOption(key: "verification-method", value: method);
+ /*
if (method != kUsePermanentPassword) {
await bind.mainSetOption(
key: 'allow-hide-cm', value: bool2option('allow-hide-cm', false));
}
+ */
}
String get temporaryPasswordLength {
@@ -99,10 +101,12 @@ class ServerModel with ChangeNotifier {
setApproveMode(String mode) async {
await bind.mainSetOption(key: 'approve-mode', value: mode);
+ /*
if (mode != 'password') {
await bind.mainSetOption(
key: 'allow-hide-cm', value: bool2option('allow-hide-cm', false));
}
+ */
}
TextEditingController get serverId => _serverId;
diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs
index 436a95587..f4ef1434e 100644
--- a/src/flutter_ffi.rs
+++ b/src/flutter_ffi.rs
@@ -395,7 +395,7 @@ pub fn session_is_keyboard_mode_supported(session_id: SessionID, mode: String) -
SyncReturn(is_keyboard_mode_supported(
&mode,
session.get_peer_version(),
- &session.peer_platform()
+ &session.peer_platform(),
))
} else {
SyncReturn(false)
@@ -1529,6 +1529,21 @@ pub fn cm_switch_back(conn_id: i32) {
crate::ui_cm_interface::switch_back(conn_id);
}
+pub fn cm_get_config(name: String) -> String {
+ #[cfg(not(target_os = "ios"))]
+ {
+ if let Ok(Some(v)) = crate::ipc::get_config(&name) {
+ v
+ } else {
+ "".to_string()
+ }
+ }
+ #[cfg(target_os = "ios")]
+ {
+ "".to_string()
+ }
+}
+
pub fn main_get_build_date() -> String {
crate::BUILD_DATE.to_string()
}
diff --git a/src/ipc.rs b/src/ipc.rs
index 7965b00d5..43cf50ecf 100644
--- a/src/ipc.rs
+++ b/src/ipc.rs
@@ -408,6 +408,12 @@ async fn handle(data: Data, stream: &mut Connection) {
} else {
None
};
+ } else if name == "hide_cm" {
+ value = if crate::hbbs_http::sync::is_pro() {
+ Some(hbb_common::password_security::hide_cm().to_string())
+ } else {
+ None
+ };
} else {
value = None;
}
@@ -699,7 +705,7 @@ where
}
#[tokio::main(flavor = "current_thread")]
-async fn get_config(name: &str) -> ResultType<Option<String>> {
+pub async fn get_config(name: &str) -> ResultType<Option<String>> {
get_config_async(name, 1_000).await
}
diff --git a/src/server/connection.rs b/src/server/connection.rs
index f03bde8aa..b0fd19891 100644
--- a/src/server/connection.rs
+++ b/src/server/connection.rs
@@ -26,6 +26,8 @@ use cidr_utils::cidr::IpCidr;
#[cfg(all(target_os = "linux", feature = "linux_headless"))]
#[cfg(not(any(feature = "flatpak", feature = "appimage")))]
use hbb_common::platform::linux::run_cmds;
+#[cfg(target_os = "android")]
+use hbb_common::protobuf::EnumOrUnknown;
use hbb_common::{
config::Config,
fs,
@@ -34,7 +36,6 @@ use hbb_common::{
get_time, get_version_number,
message_proto::{option_message::BoolOption, permission_info::Permission},
password_security::{self as password, ApproveMode},
- protobuf::EnumOrUnknown,
sleep, timeout,
tokio::{
net::TcpStream,
@@ -2791,9 +2792,6 @@ async fn start_ipc(
#[allow(unused_mut)]
#[allow(unused_assignments)]
let mut args = vec!["--cm"];
- if crate::hbbs_http::sync::is_pro() && password::hide_cm() {
- args.push("--hide");
- }
#[allow(unused_mut)]
#[cfg(target_os = "linux")]
let mut user = None;