Merge pull request #5873 from 21pages/cm_width
opt cm width and elevation requires keyboard permission
This commit is contained in:
commit
6e3e60a44d
@ -711,6 +711,13 @@ void showWaitUacDialog(
|
||||
(setState, close, context) => CustomAlertDialog(
|
||||
title: null,
|
||||
content: msgboxContent(type, 'Wait', 'wait_accept_uac_tip'),
|
||||
actions: [
|
||||
dialogButton(
|
||||
'OK',
|
||||
icon: Icon(Icons.done_rounded),
|
||||
onPressed: close,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@ -931,7 +938,7 @@ void showElevationError(SessionID sessionId, String type, String title,
|
||||
dialogButton('Cancel', onPressed: () {
|
||||
close();
|
||||
}, isOutline: true),
|
||||
dialogButton('Retry', onPressed: submit),
|
||||
if (text != 'No permission') dialogButton('Retry', onPressed: submit),
|
||||
],
|
||||
onSubmit: submit,
|
||||
onCancel: close,
|
||||
|
@ -49,7 +49,8 @@ class TToggleMenu {
|
||||
handleOsPasswordEditIcon(
|
||||
SessionID sessionId, OverlayDialogManager dialogManager) {
|
||||
isEditOsPassword = true;
|
||||
showSetOSPassword(sessionId, false, dialogManager, null, () => isEditOsPassword = false);
|
||||
showSetOSPassword(
|
||||
sessionId, false, dialogManager, null, () => isEditOsPassword = false);
|
||||
}
|
||||
|
||||
handleOsPasswordAction(
|
||||
@ -62,7 +63,8 @@ handleOsPasswordAction(
|
||||
await bind.sessionGetOption(sessionId: sessionId, arg: 'os-password') ??
|
||||
'';
|
||||
if (password.isEmpty) {
|
||||
showSetOSPassword(sessionId, true, dialogManager, password, () => isEditOsPassword = false);
|
||||
showSetOSPassword(sessionId, true, dialogManager, password,
|
||||
() => isEditOsPassword = false);
|
||||
} else {
|
||||
bind.sessionInputOsPassword(sessionId: sessionId, value: password);
|
||||
}
|
||||
@ -76,7 +78,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
|
||||
|
||||
List<TTextMenu> v = [];
|
||||
// elevation
|
||||
if (ffi.elevationModel.showRequestMenu) {
|
||||
if (perms['keyboard'] != false && ffi.elevationModel.showRequestMenu) {
|
||||
v.add(
|
||||
TTextMenu(
|
||||
child: Text(translate('Request Elevation')),
|
||||
|
@ -175,34 +175,47 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
||||
],
|
||||
);
|
||||
},
|
||||
pageViewBuilder: (pageView) => Row(
|
||||
children: [
|
||||
Consumer<ChatModel>(
|
||||
builder: (_, model, child) => model.isShowCMSidePage
|
||||
? Expanded(
|
||||
child: buildRemoteBlock(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
right: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.dividerColor))),
|
||||
child: buildSidePage()),
|
||||
),
|
||||
flex: (kConnectionManagerWindowSizeOpenChat.width -
|
||||
kConnectionManagerWindowSizeClosedChat
|
||||
.width)
|
||||
.toInt(),
|
||||
)
|
||||
: Offstage(),
|
||||
),
|
||||
Expanded(
|
||||
child: pageView,
|
||||
flex: kConnectionManagerWindowSizeClosedChat.width
|
||||
.toInt() -
|
||||
4 // prevent stretch of the page view when chat is open,
|
||||
),
|
||||
],
|
||||
pageViewBuilder: (pageView) => LayoutBuilder(
|
||||
builder: (context, constrains) {
|
||||
var borderWidth = 0.0;
|
||||
if (constrains.maxWidth >
|
||||
kConnectionManagerWindowSizeClosedChat.width) {
|
||||
borderWidth = kConnectionManagerWindowSizeOpenChat.width -
|
||||
constrains.maxWidth;
|
||||
} else {
|
||||
borderWidth = kConnectionManagerWindowSizeClosedChat.width -
|
||||
constrains.maxWidth;
|
||||
}
|
||||
if (borderWidth < 0 || borderWidth > 50) {
|
||||
borderWidth = 0;
|
||||
}
|
||||
final realClosedWidth =
|
||||
kConnectionManagerWindowSizeClosedChat.width -
|
||||
borderWidth;
|
||||
final realChatPageWidth =
|
||||
constrains.maxWidth - realClosedWidth;
|
||||
return Row(children: [
|
||||
if (constrains.maxWidth >
|
||||
kConnectionManagerWindowSizeClosedChat.width)
|
||||
Consumer<ChatModel>(
|
||||
builder: (_, model, child) => SizedBox(
|
||||
width: realChatPageWidth,
|
||||
child: buildRemoteBlock(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
right: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.dividerColor))),
|
||||
child: buildSidePage()),
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
width: realClosedWidth,
|
||||
child:
|
||||
SizedBox(width: realClosedWidth, child: pageView)),
|
||||
]);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -966,8 +979,7 @@ class __FileTransferLogPageState extends State<_FileTransferLogPage> {
|
||||
return PreferredSize(
|
||||
preferredSize: const Size(200, double.infinity),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Obx(
|
||||
() {
|
||||
final jobTable = gFFI.cmFileModel.currentJobTable;
|
||||
|
@ -285,7 +285,10 @@ class ChatModel with ChangeNotifier {
|
||||
await toggleCMSidePage();
|
||||
}
|
||||
|
||||
var _togglingCMSidePage = false; // protect order for await
|
||||
toggleCMSidePage() async {
|
||||
if (_togglingCMSidePage) return false;
|
||||
_togglingCMSidePage = true;
|
||||
if (_isShowCMSidePage) {
|
||||
_isShowCMSidePage = !_isShowCMSidePage;
|
||||
notifyListeners();
|
||||
@ -300,6 +303,7 @@ class ChatModel with ChangeNotifier {
|
||||
_isShowCMSidePage = !_isShowCMSidePage;
|
||||
notifyListeners();
|
||||
}
|
||||
_togglingCMSidePage = false;
|
||||
}
|
||||
|
||||
changeCurrentKey(MessageKey key) {
|
||||
|
@ -1318,9 +1318,10 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(misc::Union::Uac(uac)) => {
|
||||
let keyboard = self.handler.server_keyboard_enabled.read().unwrap().clone();
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
if uac {
|
||||
if uac && keyboard {
|
||||
self.handler.msgbox(
|
||||
"on-uac",
|
||||
"Prompt",
|
||||
@ -1339,7 +1340,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
let title = "Prompt";
|
||||
let text = "Please wait for confirmation of UAC...";
|
||||
let link = "";
|
||||
if uac {
|
||||
if uac && keyboard {
|
||||
self.handler.msgbox(msgtype, title, text, link);
|
||||
} else {
|
||||
self.handler.cancel_msgbox(&format!(
|
||||
@ -1350,9 +1351,10 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(misc::Union::ForegroundWindowElevated(elevated)) => {
|
||||
let keyboard = self.handler.server_keyboard_enabled.read().unwrap().clone();
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
if elevated {
|
||||
if elevated && keyboard {
|
||||
self.handler.msgbox(
|
||||
"on-foreground-elevated",
|
||||
"Prompt",
|
||||
@ -1371,7 +1373,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
let title = "Prompt";
|
||||
let text = "elevated_foreground_window_tip";
|
||||
let link = "";
|
||||
if elevated {
|
||||
if elevated && keyboard {
|
||||
self.handler.msgbox(msgtype, title, text, link);
|
||||
} else {
|
||||
self.handler.cancel_msgbox(&format!(
|
||||
@ -1385,6 +1387,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
if err.is_empty() {
|
||||
self.handler.msgbox("wait-uac", "", "", "");
|
||||
} else {
|
||||
self.handler.cancel_msgbox("wait-uac");
|
||||
self.handler
|
||||
.msgbox("elevation-error", "Elevation Error", &err, "");
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "启动时检查软件更新"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"),
|
||||
("pull_group_failed_tip", "获取组信息失败"),
|
||||
("No permission", "没有权限"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Beim Start auf Softwareaktualisierung prüfen"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Bitte aktualisieren Sie RustDesk Server Pro auf die Version {} oder neuer!"),
|
||||
("pull_group_failed_tip", "Aktualisierung der Gruppe fehlgeschlagen"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Comprobar actualización al iniciar"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "¡Por favor, actualiza RustDesk Server Pro a la versión {} o superior"),
|
||||
("pull_group_failed_tip", "No se ha podido refrescar el grupo"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Vérifier la disponibilité des mises à jour au démarrage"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Veuillez mettre à jour RustDesk Server Pro avec la version {} ou une version plus récente !"),
|
||||
("pull_group_failed_tip", "Échec de l'actualisation du groupe"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Periksa pembaruan aplikasi saat sistem dinyalakan."),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Silahkan perbarui RustDesk Server Pro ke versi {} atau yang lebih baru!"),
|
||||
("pull_group_failed_tip", "Gagal memperbarui grup"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "All'avvio verifica presenza aggiornamenti programma"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Aggiorna RustDesk Server Pro alla versione {} o successiva!"),
|
||||
("pull_group_failed_tip", "Impossibile aggiornare il gruppo"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("ID Server", "ID serveris"),
|
||||
("Relay Server", "Releja serveris"),
|
||||
("API Server", "API serveris"),
|
||||
("Key", "Atslēga"),
|
||||
("invalid_http", "jāsākas ar http:// vai https://"),
|
||||
("Invalid IP", "Nederīga IP"),
|
||||
("Invalid format", "Nederīgs formāts"),
|
||||
@ -297,7 +296,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("This file exists, skip or overwrite this file?", "Šis fails pastāv, izlaist vai pārrakstīt šo failu?"),
|
||||
("Quit", "Iziet"),
|
||||
("doc_mac_permission", "https://rustdesk.com/docs/en/manual/mac/#enable-permissions"),
|
||||
("doc_fix_wayland", "https://rustdesk.com/docs/en/manual/linux/#x11-required"),
|
||||
("Help", "Palīdzība"),
|
||||
("Failed", "Neizdevās"),
|
||||
("Succeeded", "Izdevās"),
|
||||
@ -481,7 +479,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Me", "Es"),
|
||||
("identical_file_tip", "Šis fails ir identisks sesijas failam."),
|
||||
("show_monitors_tip", "Rādīt monitorus rīkjoslā"),
|
||||
("enter_rustdesk_passwd_tip", "Ievadiet RustDesk paroli"),
|
||||
("View Mode", "Skatīšanas režīms"),
|
||||
("login_linux_tip", "Jums ir jāpiesakās attālajā Linux kontā, lai iespējotu X darbvirsmas sesiju"),
|
||||
("verify_rustdesk_password_tip", "Pārbaudīt RustDesk paroli"),
|
||||
@ -560,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Startējot pārbaudīt, vai nav programmatūras atjauninājumu"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Lūdzu, jauniniet RustDesk Server Pro uz versiju {} vai jaunāku!"),
|
||||
("pull_group_failed_tip", "Neizdevās atsvaidzināt grupu"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Sprawdź aktualizacje przy starcie programu"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Proszę zaktualizować RustDesk Server Pro do wersji {} lub nowszej!"),
|
||||
("pull_group_failed_tip", "Błąd odświeżania grup"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", "Проверять обновления программы при запуске"),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", "Обновите RustDesk Server Pro до версии {} или новее!"),
|
||||
("pull_group_failed_tip", "Невозможно обновить группу"),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Check for software update on startup", ""),
|
||||
("upgrade_rustdesk_server_pro_to_{}_tip", ""),
|
||||
("pull_group_failed_tip", ""),
|
||||
("No permission", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -1587,29 +1587,6 @@ pub fn is_elevated(process_id: Option<DWORD>) -> ResultType<bool> {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn filter_foreground_window(process_id: DWORD) -> ResultType<bool> {
|
||||
if let Ok(output) = std::process::Command::new("tasklist")
|
||||
.args(vec![
|
||||
"/SVC",
|
||||
"/NH",
|
||||
"/FI",
|
||||
&format!("PID eq {}", process_id),
|
||||
])
|
||||
.creation_flags(CREATE_NO_WINDOW)
|
||||
.output()
|
||||
{
|
||||
let s = String::from_utf8_lossy(&output.stdout)
|
||||
.to_string()
|
||||
.to_lowercase();
|
||||
Ok(["Taskmgr", "mmc", "regedit"]
|
||||
.iter()
|
||||
.any(|name| s.contains(&name.to_string().to_lowercase())))
|
||||
} else {
|
||||
bail!("run tasklist failed");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_foreground_window_elevated() -> ResultType<bool> {
|
||||
unsafe {
|
||||
let mut process_id: DWORD = 0;
|
||||
@ -1617,12 +1594,7 @@ pub fn is_foreground_window_elevated() -> ResultType<bool> {
|
||||
if process_id == 0 {
|
||||
bail!("Failed to get processId, errno {}", GetLastError())
|
||||
}
|
||||
let elevated = is_elevated(Some(process_id))?;
|
||||
if elevated {
|
||||
filter_foreground_window(process_id)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
is_elevated(Some(process_id))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2047,12 +2047,18 @@ impl Connection {
|
||||
|
||||
#[cfg(windows)]
|
||||
async fn handle_elevation_request(&mut self, para: portable_client::StartPara) {
|
||||
let mut err = "No need to elevate".to_string();
|
||||
if !crate::platform::is_installed() && !portable_client::running() {
|
||||
err = portable_client::start_portable_service(para)
|
||||
.err()
|
||||
.map_or("".to_string(), |e| e.to_string());
|
||||
let mut err;
|
||||
if !self.keyboard {
|
||||
err = "No permission".to_string();
|
||||
} else {
|
||||
err = "No need to elevate".to_string();
|
||||
if !crate::platform::is_installed() && !portable_client::running() {
|
||||
err = portable_client::start_portable_service(para)
|
||||
.err()
|
||||
.map_or("".to_string(), |e| e.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
let mut misc = Misc::new();
|
||||
misc.set_elevation_response(err);
|
||||
let mut msg = Message::new();
|
||||
@ -2369,6 +2375,7 @@ impl Connection {
|
||||
if self.portable.is_installed
|
||||
|| self.file_transfer.is_some()
|
||||
|| self.port_forward_socket.is_some()
|
||||
|| !self.keyboard
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user