mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-13 03:16:17 +02:00
flutter version allow hide cm
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
c26e86288d
commit
8b4d50f3fb
37 changed files with 198 additions and 44 deletions
|
@ -4,6 +4,7 @@ import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hbb/common/widgets/address_book.dart';
|
import 'package:flutter_hbb/common/widgets/address_book.dart';
|
||||||
import 'package:flutter_hbb/consts.dart';
|
import 'package:flutter_hbb/consts.dart';
|
||||||
|
@ -177,12 +178,15 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Expanded(
|
||||||
translate('Control Remote Desktop'),
|
child: AutoSizeText(
|
||||||
style: Theme.of(context)
|
translate('Control Remote Desktop'),
|
||||||
.textTheme
|
maxLines: 1,
|
||||||
.titleLarge
|
style: Theme.of(context)
|
||||||
?.merge(TextStyle(height: 1)),
|
.textTheme
|
||||||
|
.titleLarge
|
||||||
|
?.merge(TextStyle(height: 1)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).marginOnly(bottom: 15),
|
).marginOnly(bottom: 15),
|
||||||
|
|
|
@ -658,13 +658,9 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||||
initialKey: modeInitialKey,
|
initialKey: modeInitialKey,
|
||||||
onChanged: (key) => model.setApproveMode(key),
|
onChanged: (key) => model.setApproveMode(key),
|
||||||
).marginOnly(left: _kContentHMargin),
|
).marginOnly(left: _kContentHMargin),
|
||||||
Offstage(
|
if (usePassword) radios[0],
|
||||||
offstage: !usePassword,
|
if (usePassword)
|
||||||
child: radios[0],
|
_SubLabeledWidget(
|
||||||
),
|
|
||||||
Offstage(
|
|
||||||
offstage: !usePassword,
|
|
||||||
child: _SubLabeledWidget(
|
|
||||||
'One-time password length',
|
'One-time password length',
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -672,20 +668,13 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
enabled: tmpEnabled && !locked),
|
enabled: tmpEnabled && !locked),
|
||||||
),
|
if (usePassword) radios[1],
|
||||||
Offstage(
|
if (usePassword)
|
||||||
offstage: !usePassword,
|
_SubButton('Set permanent password', setPasswordDialog,
|
||||||
child: radios[1],
|
|
||||||
),
|
|
||||||
Offstage(
|
|
||||||
offstage: !usePassword,
|
|
||||||
child: _SubButton('Set permanent password', setPasswordDialog,
|
|
||||||
permEnabled && !locked),
|
permEnabled && !locked),
|
||||||
),
|
if (usePassword)
|
||||||
Offstage(
|
hide_cm(!locked).marginOnly(left: _kContentHSubMargin - 6),
|
||||||
offstage: !usePassword,
|
if (usePassword) radios[2],
|
||||||
child: radios[2],
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@ -814,6 +803,46 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||||
).marginOnly(left: _kCheckBoxLeftMargin);
|
).marginOnly(left: _kCheckBoxLeftMargin);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget hide_cm(bool enabled) {
|
||||||
|
return ChangeNotifierProvider.value(
|
||||||
|
value: gFFI.serverModel,
|
||||||
|
child: Consumer<ServerModel>(builder: (context, model, child) {
|
||||||
|
final enableHideCm = model.approveMode == 'password' &&
|
||||||
|
model.verificationMethod == kUsePermanentPassword;
|
||||||
|
onHideCmChanged(bool? b) {
|
||||||
|
if (b != null) {
|
||||||
|
bind.mainSetOption(
|
||||||
|
key: 'allow-hide-cm', value: bool2option('allow-hide-cm', b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Tooltip(
|
||||||
|
message: enableHideCm ? "" : translate('hide_cm_tip'),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap:
|
||||||
|
enableHideCm ? () => onHideCmChanged(!model.hideCm) : null,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: model.hideCm,
|
||||||
|
onChanged: enabled && enableHideCm
|
||||||
|
? onHideCmChanged
|
||||||
|
: null)
|
||||||
|
.marginOnly(right: 5),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
translate('Hide connection management window'),
|
||||||
|
style: TextStyle(
|
||||||
|
color: _disabledTextColor(
|
||||||
|
context, enabled && enableHideCm)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Network extends StatefulWidget {
|
class _Network extends StatefulWidget {
|
||||||
|
|
|
@ -85,7 +85,7 @@ Future<void> main(List<String> args) async {
|
||||||
debugPrint("--cm started");
|
debugPrint("--cm started");
|
||||||
desktopType = DesktopType.cm;
|
desktopType = DesktopType.cm;
|
||||||
await windowManager.ensureInitialized();
|
await windowManager.ensureInitialized();
|
||||||
runConnectionManagerScreen();
|
runConnectionManagerScreen(args.contains('--hide'));
|
||||||
} else if (args.contains('--install')) {
|
} else if (args.contains('--install')) {
|
||||||
runInstallPage();
|
runInstallPage();
|
||||||
} else {
|
} else {
|
||||||
|
@ -185,16 +185,23 @@ void runMultiWindow(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void runConnectionManagerScreen() async {
|
void runConnectionManagerScreen(bool hide) async {
|
||||||
await initEnv(kAppTypeMain);
|
await initEnv(kAppTypeMain);
|
||||||
// initialize window
|
|
||||||
WindowOptions windowOptions =
|
|
||||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
|
||||||
_runApp(
|
_runApp(
|
||||||
'',
|
'',
|
||||||
const DesktopServerPage(),
|
const DesktopServerPage(),
|
||||||
MyTheme.currentThemeMode(),
|
MyTheme.currentThemeMode(),
|
||||||
);
|
);
|
||||||
|
if (hide) {
|
||||||
|
hideCmWindow();
|
||||||
|
} else {
|
||||||
|
showCmWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCmWindow() {
|
||||||
|
WindowOptions windowOptions =
|
||||||
|
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
||||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
|
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
|
||||||
|
@ -204,6 +211,15 @@ void runConnectionManagerScreen() async {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hideCmWindow() {
|
||||||
|
WindowOptions windowOptions =
|
||||||
|
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
||||||
|
windowManager.setOpacity(0);
|
||||||
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||||
|
await windowManager.hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void _runApp(
|
void _runApp(
|
||||||
String title,
|
String title,
|
||||||
Widget home,
|
Widget home,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hbb/main.dart';
|
||||||
import 'package:flutter_hbb/models/platform_model.dart';
|
import 'package:flutter_hbb/models/platform_model.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:wakelock/wakelock.dart';
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
@ -28,6 +29,7 @@ class ServerModel with ChangeNotifier {
|
||||||
bool _audioOk = false;
|
bool _audioOk = false;
|
||||||
bool _fileOk = false;
|
bool _fileOk = false;
|
||||||
bool _showElevation = true;
|
bool _showElevation = true;
|
||||||
|
bool _hideCm = false;
|
||||||
int _connectStatus = 0; // Rendezvous Server status
|
int _connectStatus = 0; // Rendezvous Server status
|
||||||
String _verificationMethod = "";
|
String _verificationMethod = "";
|
||||||
String _temporaryPasswordLength = "";
|
String _temporaryPasswordLength = "";
|
||||||
|
@ -56,6 +58,8 @@ class ServerModel with ChangeNotifier {
|
||||||
|
|
||||||
bool get showElevation => _showElevation;
|
bool get showElevation => _showElevation;
|
||||||
|
|
||||||
|
bool get hideCm => _hideCm;
|
||||||
|
|
||||||
int get connectStatus => _connectStatus;
|
int get connectStatus => _connectStatus;
|
||||||
|
|
||||||
String get verificationMethod {
|
String get verificationMethod {
|
||||||
|
@ -74,6 +78,10 @@ class ServerModel with ChangeNotifier {
|
||||||
|
|
||||||
setVerificationMethod(String method) async {
|
setVerificationMethod(String method) async {
|
||||||
await bind.mainSetOption(key: "verification-method", value: method);
|
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 {
|
String get temporaryPasswordLength {
|
||||||
|
@ -90,6 +98,10 @@ class ServerModel with ChangeNotifier {
|
||||||
|
|
||||||
setApproveMode(String mode) async {
|
setApproveMode(String mode) async {
|
||||||
await bind.mainSetOption(key: 'approve-mode', value: mode);
|
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;
|
TextEditingController get serverId => _serverId;
|
||||||
|
@ -125,7 +137,11 @@ class ServerModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isTest) {
|
if (!isTest) {
|
||||||
Future.delayed(Duration.zero, timerCallback);
|
Future.delayed(Duration.zero, () async {
|
||||||
|
if (await bind.optionSynced()) {
|
||||||
|
await timerCallback();
|
||||||
|
}
|
||||||
|
});
|
||||||
Timer.periodic(Duration(milliseconds: 500), (timer) async {
|
Timer.periodic(Duration(milliseconds: 500), (timer) async {
|
||||||
await timerCallback();
|
await timerCallback();
|
||||||
});
|
});
|
||||||
|
@ -166,6 +182,12 @@ class ServerModel with ChangeNotifier {
|
||||||
final temporaryPasswordLength =
|
final temporaryPasswordLength =
|
||||||
await bind.mainGetOption(key: "temporary-password-length");
|
await bind.mainGetOption(key: "temporary-password-length");
|
||||||
final approveMode = await bind.mainGetOption(key: 'approve-mode');
|
final approveMode = await bind.mainGetOption(key: 'approve-mode');
|
||||||
|
var hideCm = option2bool(
|
||||||
|
'allow-hide-cm', await bind.mainGetOption(key: 'allow-hide-cm'));
|
||||||
|
if (!(approveMode == 'password' &&
|
||||||
|
verificationMethod == kUsePermanentPassword)) {
|
||||||
|
hideCm = false;
|
||||||
|
}
|
||||||
if (_approveMode != approveMode) {
|
if (_approveMode != approveMode) {
|
||||||
_approveMode = approveMode;
|
_approveMode = approveMode;
|
||||||
update = true;
|
update = true;
|
||||||
|
@ -190,6 +212,17 @@ class ServerModel with ChangeNotifier {
|
||||||
_temporaryPasswordLength = temporaryPasswordLength;
|
_temporaryPasswordLength = temporaryPasswordLength;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
if (_hideCm != hideCm) {
|
||||||
|
_hideCm = hideCm;
|
||||||
|
if (desktopType == DesktopType.cm) {
|
||||||
|
if (hideCm) {
|
||||||
|
hideCmWindow();
|
||||||
|
} else {
|
||||||
|
showCmWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
if (update) {
|
if (update) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -436,11 +469,11 @@ class ServerModel with ChangeNotifier {
|
||||||
},
|
},
|
||||||
page: desktop.buildConnectionCard(client)));
|
page: desktop.buildConnectionCard(client)));
|
||||||
Future.delayed(Duration.zero, () async {
|
Future.delayed(Duration.zero, () async {
|
||||||
window_on_top(null);
|
if (!hideCm) window_on_top(null);
|
||||||
});
|
});
|
||||||
if (client.authorized) {
|
if (client.authorized) {
|
||||||
cmHiddenTimer = Timer(const Duration(seconds: 3), () {
|
cmHiddenTimer = Timer(const Duration(seconds: 3), () {
|
||||||
windowManager.minimize();
|
if (!hideCm) windowManager.minimize();
|
||||||
cmHiddenTimer = null;
|
cmHiddenTimer = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,12 @@ pub fn approve_mode() -> ApproveMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn hide_cm() -> bool {
|
||||||
|
approve_mode() == ApproveMode::Password
|
||||||
|
&& verification_method() == VerificationMethod::OnlyUsePermanentPassword
|
||||||
|
&& !Config::get_option("allow-hide-cm").is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
const VERSION_LEN: usize = 2;
|
const VERSION_LEN: usize = 2;
|
||||||
|
|
||||||
pub fn encrypt_str_or_original(s: &str, version: &str) -> String {
|
pub fn encrypt_str_or_original(s: &str, version: &str) -> String {
|
||||||
|
|
|
@ -1098,6 +1098,10 @@ pub fn version_to_number(v: String) -> i64 {
|
||||||
hbb_common::get_version_number(&v)
|
hbb_common::get_version_number(&v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn option_synced() -> bool {
|
||||||
|
crate::ui_interface::option_synced()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main_is_installed() -> SyncReturn<bool> {
|
pub fn main_is_installed() -> SyncReturn<bool> {
|
||||||
SyncReturn(is_installed())
|
SyncReturn(is_installed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,5 +394,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "使用一次性密码"),
|
("Use one-time password", "使用一次性密码"),
|
||||||
("One-time password length", "一次性密码长度"),
|
("One-time password length", "一次性密码长度"),
|
||||||
("Request access to your device", "请求访问你的设备"),
|
("Request access to your device", "请求访问你的设备"),
|
||||||
|
("Hide connection management window", "隐藏连接管理窗口"),
|
||||||
|
("hide_cm_tip", "在只允许密码连接并且只用固定密码的情况下才允许隐藏"),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "Einmalpasswort verwenden"),
|
("Use one-time password", "Einmalpasswort verwenden"),
|
||||||
("One-time password length", "Länge des Einmalpassworts"),
|
("One-time password length", "Länge des Einmalpassworts"),
|
||||||
("Request access to your device", "Zugriff zu Ihrem Gerät erbitten"),
|
("Request access to your device", "Zugriff zu Ihrem Gerät erbitten"),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("elevated_foreground_window_tip", "The current window of the remote desktop requires higher privilege to operate, so it's unable to use the mouse and keyboard temporarily. You can request the remote user to minimize the current window, or click elevation button on the connection management window. To avoid this problem, it is recommended to install the software on the remote device."),
|
("elevated_foreground_window_tip", "The current window of the remote desktop requires higher privilege to operate, so it's unable to use the mouse and keyboard temporarily. You can request the remote user to minimize the current window, or click elevation button on the connection management window. To avoid this problem, it is recommended to install the software on the remote device."),
|
||||||
("JumpLink", "View"),
|
("JumpLink", "View"),
|
||||||
("Stop service", "Stop Service"),
|
("Stop service", "Stop Service"),
|
||||||
("or", ""),
|
("hide_cm_tip", "Allow hiding only if accepting sessions via password and using pernament password"),
|
||||||
("Continue with", ""),
|
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "Usar contraseña de un solo uso"),
|
("Use one-time password", "Usar contraseña de un solo uso"),
|
||||||
("One-time password length", "Longitud de la contraseña de un solo uso"),
|
("One-time password length", "Longitud de la contraseña de un solo uso"),
|
||||||
("Request access to your device", "Solicitud de acceso a su dispositivo"),
|
("Request access to your device", "Solicitud de acceso a su dispositivo"),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,5 +394,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "استفاده از رمز عبور یکبار مصرف"),
|
("Use one-time password", "استفاده از رمز عبور یکبار مصرف"),
|
||||||
("One-time password length", "طول رمز عبور یکبار مصرف"),
|
("One-time password length", "طول رمز عبور یکبار مصرف"),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "Usa password monouso"),
|
("Use one-time password", "Usa password monouso"),
|
||||||
("One-time password length", "Lunghezza password monouso"),
|
("One-time password length", "Lunghezza password monouso"),
|
||||||
("Request access to your device", "Richiedi l'accesso al tuo dispositivo"),
|
("Request access to your device", "Richiedi l'accesso al tuo dispositivo"),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "Użyj hasła jednorazowego"),
|
("Use one-time password", "Użyj hasła jednorazowego"),
|
||||||
("One-time password length", "Długość hasła jednorazowego"),
|
("One-time password length", "Długość hasła jednorazowego"),
|
||||||
("Request access to your device", "Żądanie dostępu do Twojego urządzenia"),
|
("Request access to your device", "Żądanie dostępu do Twojego urządzenia"),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "Usar senha de uso único"),
|
("Use one-time password", "Usar senha de uso único"),
|
||||||
("One-time password length", "Comprimento da senha de uso único"),
|
("One-time password length", "Comprimento da senha de uso único"),
|
||||||
("Request access to your device", "Solicitar acesso ao seu dispositivo"),
|
("Request access to your device", "Solicitar acesso ao seu dispositivo"),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", "使用一次性密碼"),
|
("Use one-time password", "使用一次性密碼"),
|
||||||
("One-time password length", "一次性密碼長度"),
|
("One-time password length", "一次性密碼長度"),
|
||||||
("Request access to your device", "請求訪問你的設備"),
|
("Request access to your device", "請求訪問你的設備"),
|
||||||
|
("Hide connection management window", "隱藏連接管理窗口"),
|
||||||
|
("hide_cm_tip", "在只允許密碼連接並且只用固定密碼的情況下才允許隱藏"),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,5 +395,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||||
("Use one-time password", ""),
|
("Use one-time password", ""),
|
||||||
("One-time password length", ""),
|
("One-time password length", ""),
|
||||||
("Request access to your device", ""),
|
("Request access to your device", ""),
|
||||||
|
("Hide connection management window", ""),
|
||||||
|
("hide_cm_tip", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1571,17 +1571,18 @@ async fn start_ipc(
|
||||||
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
|
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
|
||||||
stream = Some(s);
|
stream = Some(s);
|
||||||
} else {
|
} else {
|
||||||
|
let extra_args = if password::hide_cm() { "--hide" } else { "" };
|
||||||
let run_done;
|
let run_done;
|
||||||
if crate::platform::is_root() {
|
if crate::platform::is_root() {
|
||||||
let mut res = Ok(None);
|
let mut res = Ok(None);
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
{
|
{
|
||||||
res = crate::platform::run_as_user("--cm");
|
res = crate::platform::run_as_user(&format!("--cm {}", extra_args));
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
res = crate::platform::run_as_user("--cm", None);
|
res = crate::platform::run_as_user(&format!("--cm {}", extra_args), None);
|
||||||
}
|
}
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
break;
|
break;
|
||||||
|
@ -1596,10 +1597,14 @@ async fn start_ipc(
|
||||||
run_done = false;
|
run_done = false;
|
||||||
}
|
}
|
||||||
if !run_done {
|
if !run_done {
|
||||||
|
let mut args = vec!["--cm"];
|
||||||
|
if !extra_args.is_empty() {
|
||||||
|
args.push(&extra_args);
|
||||||
|
}
|
||||||
super::CHILD_PROCESS
|
super::CHILD_PROCESS
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.push(crate::run_me(vec!["--cm"])?);
|
.push(crate::run_me(args)?);
|
||||||
}
|
}
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
sleep(0.3).await;
|
sleep(0.3).await;
|
||||||
|
|
|
@ -192,7 +192,7 @@ fn create_capturer(
|
||||||
privacy_mode_id: i32,
|
privacy_mode_id: i32,
|
||||||
display: Display,
|
display: Display,
|
||||||
use_yuv: bool,
|
use_yuv: bool,
|
||||||
current: usize,
|
_current: usize,
|
||||||
_portable_service_running: bool,
|
_portable_service_running: bool,
|
||||||
) -> ResultType<Box<dyn TraitCapturer>> {
|
) -> ResultType<Box<dyn TraitCapturer>> {
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
|
@ -256,7 +256,7 @@ fn create_capturer(
|
||||||
log::debug!("Create capturer dxgi|gdi");
|
log::debug!("Create capturer dxgi|gdi");
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
return crate::portable_service::client::create_capturer(
|
return crate::portable_service::client::create_capturer(
|
||||||
current,
|
_current,
|
||||||
display,
|
display,
|
||||||
use_yuv,
|
use_yuv,
|
||||||
_portable_service_running,
|
_portable_service_running,
|
||||||
|
|
|
@ -784,11 +784,11 @@ pub fn can_elevate() -> bool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn elevate_portable(id: i32) {
|
pub fn elevate_portable(_id: i32) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
let lock = CLIENTS.read().unwrap();
|
let lock = CLIENTS.read().unwrap();
|
||||||
if let Some(s) = lock.get(&id) {
|
if let Some(s) = lock.get(&_id) {
|
||||||
allow_err!(s.tx.send(ipc::Data::DataPortableService(
|
allow_err!(s.tx.send(ipc::Data::DataPortableService(
|
||||||
ipc::DataPortableService::RequestStart
|
ipc::DataPortableService::RequestStart
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -39,6 +39,7 @@ lazy_static::lazy_static! {
|
||||||
static ref OPTIONS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(Config::get_options()));
|
static ref OPTIONS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(Config::get_options()));
|
||||||
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
||||||
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
||||||
|
pub static ref OPTION_SYNCED : Arc<Mutex<bool>> = Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
|
@ -924,7 +925,8 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||||
UI_STATUS.lock().unwrap().2 = v;
|
UI_STATUS.lock().unwrap().2 = v;
|
||||||
}
|
}
|
||||||
Ok(Some(ipc::Data::Options(Some(v)))) => {
|
Ok(Some(ipc::Data::Options(Some(v)))) => {
|
||||||
*OPTIONS.lock().unwrap() = v
|
*OPTIONS.lock().unwrap() = v;
|
||||||
|
*OPTION_SYNCED.lock().unwrap() = true;
|
||||||
}
|
}
|
||||||
Ok(Some(ipc::Data::Config((name, Some(value))))) => {
|
Ok(Some(ipc::Data::Config((name, Some(value))))) => {
|
||||||
if name == "id" {
|
if name == "id" {
|
||||||
|
@ -967,6 +969,11 @@ async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedReceiver<ipc:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn option_synced() -> bool {
|
||||||
|
OPTION_SYNCED.lock().unwrap().clone()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
pub(crate) async fn send_to_cm(data: &ipc::Data) {
|
pub(crate) async fn send_to_cm(data: &ipc::Data) {
|
||||||
|
|
|
@ -200,6 +200,7 @@ impl<T: InvokeUiSession> Session<T> {
|
||||||
h265 = h265 && encoding_265;
|
h265 = h265 && encoding_265;
|
||||||
return (h264, h265);
|
return (h264, h265);
|
||||||
}
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
(false, false)
|
(false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue