Skip to content

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

Refact. Win, file copy paste, default true (#7719)

fufesoua7a10f4eaaac
diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart
index a8638a302..e38e3fb75 100644
--- a/flutter/lib/common/widgets/toolbar.dart
+++ b/flutter/lib/common/widgets/toolbar.dart
@@ -441,10 +441,17 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
child: Text(translate('Mute'))));
}
// file copy and paste
+ // If the version is less than 1.2.4, file copy and paste is supported on Windows only.
+ final isSupportIfPeer_1_2_3 = versionCmp(pi.version, '1.2.4') < 0 &&
+ isWindows &&
+ pi.platform == kPeerPlatformWindows;
+ // If the version is 1.2.4 or later, file copy and paste is supported when kPlatformAdditionsHasFileClipboard is set.
+ final isSupportIfPeer_1_2_4 = versionCmp(pi.version, '1.2.4') >= 0 &&
+ bind.mainHasFileClipboard() &&
+ pi.platformAdditions.containsKey(kPlatformAdditionsHasFileClipboard);
if (ffiModel.keyboard &&
perms['file'] != false &&
- bind.mainHasFileClipboard() &&
- pi.platformAdditions.containsKey(kPlatformAdditionsHasFileClipboard)) {
+ (isSupportIfPeer_1_2_3 || isSupportIfPeer_1_2_4)) {
final enabled = !ffiModel.viewOnly;
final option = 'enable-file-transfer';
final value =
diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs
index 1c58ae9b2..4acfb2cdf 100644
--- a/libs/hbb_common/src/config.rs
+++ b/libs/hbb_common/src/config.rs
@@ -1561,6 +1561,7 @@ impl UserDefaultConfig {
}
"custom_image_quality" => self.get_double_string(key, 50.0, 10.0, 0xFFF as f64),
"custom-fps" => self.get_double_string(key, 30.0, 5.0, 120.0),
+ "enable_file_transfer" => self.get_string(key, "Y", vec![""]),
_ => self
.get_after(key)
.map(|v| v.to_string())