elevation: keyboard permission required and remove foreground filter

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-09-30 19:47:59 +08:00
parent d8e51c6b14
commit 17a56bbf48
41 changed files with 69 additions and 45 deletions

View File

@ -711,6 +711,13 @@ void showWaitUacDialog(
(setState, close, context) => CustomAlertDialog( (setState, close, context) => CustomAlertDialog(
title: null, title: null,
content: msgboxContent(type, 'Wait', 'wait_accept_uac_tip'), 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: () { dialogButton('Cancel', onPressed: () {
close(); close();
}, isOutline: true), }, isOutline: true),
dialogButton('Retry', onPressed: submit), if (text != 'No permission') dialogButton('Retry', onPressed: submit),
], ],
onSubmit: submit, onSubmit: submit,
onCancel: close, onCancel: close,

View File

@ -49,7 +49,8 @@ class TToggleMenu {
handleOsPasswordEditIcon( handleOsPasswordEditIcon(
SessionID sessionId, OverlayDialogManager dialogManager) { SessionID sessionId, OverlayDialogManager dialogManager) {
isEditOsPassword = true; isEditOsPassword = true;
showSetOSPassword(sessionId, false, dialogManager, null, () => isEditOsPassword = false); showSetOSPassword(
sessionId, false, dialogManager, null, () => isEditOsPassword = false);
} }
handleOsPasswordAction( handleOsPasswordAction(
@ -62,7 +63,8 @@ handleOsPasswordAction(
await bind.sessionGetOption(sessionId: sessionId, arg: 'os-password') ?? await bind.sessionGetOption(sessionId: sessionId, arg: 'os-password') ??
''; '';
if (password.isEmpty) { if (password.isEmpty) {
showSetOSPassword(sessionId, true, dialogManager, password, () => isEditOsPassword = false); showSetOSPassword(sessionId, true, dialogManager, password,
() => isEditOsPassword = false);
} else { } else {
bind.sessionInputOsPassword(sessionId: sessionId, value: password); bind.sessionInputOsPassword(sessionId: sessionId, value: password);
} }
@ -76,7 +78,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
List<TTextMenu> v = []; List<TTextMenu> v = [];
// elevation // elevation
if (ffi.elevationModel.showRequestMenu) { if (perms['keyboard'] != false && ffi.elevationModel.showRequestMenu) {
v.add( v.add(
TTextMenu( TTextMenu(
child: Text(translate('Request Elevation')), child: Text(translate('Request Elevation')),

View File

@ -1303,9 +1303,10 @@ impl<T: InvokeUiSession> Remote<T> {
} }
} }
Some(misc::Union::Uac(uac)) => { Some(misc::Union::Uac(uac)) => {
let keyboard = self.handler.server_keyboard_enabled.read().unwrap().clone();
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
{ {
if uac { if uac && keyboard {
self.handler.msgbox( self.handler.msgbox(
"on-uac", "on-uac",
"Prompt", "Prompt",
@ -1324,7 +1325,7 @@ impl<T: InvokeUiSession> Remote<T> {
let title = "Prompt"; let title = "Prompt";
let text = "Please wait for confirmation of UAC..."; let text = "Please wait for confirmation of UAC...";
let link = ""; let link = "";
if uac { if uac && keyboard {
self.handler.msgbox(msgtype, title, text, link); self.handler.msgbox(msgtype, title, text, link);
} else { } else {
self.handler.cancel_msgbox(&format!( self.handler.cancel_msgbox(&format!(
@ -1335,9 +1336,10 @@ impl<T: InvokeUiSession> Remote<T> {
} }
} }
Some(misc::Union::ForegroundWindowElevated(elevated)) => { Some(misc::Union::ForegroundWindowElevated(elevated)) => {
let keyboard = self.handler.server_keyboard_enabled.read().unwrap().clone();
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
{ {
if elevated { if elevated && keyboard {
self.handler.msgbox( self.handler.msgbox(
"on-foreground-elevated", "on-foreground-elevated",
"Prompt", "Prompt",
@ -1356,7 +1358,7 @@ impl<T: InvokeUiSession> Remote<T> {
let title = "Prompt"; let title = "Prompt";
let text = "elevated_foreground_window_tip"; let text = "elevated_foreground_window_tip";
let link = ""; let link = "";
if elevated { if elevated && keyboard {
self.handler.msgbox(msgtype, title, text, link); self.handler.msgbox(msgtype, title, text, link);
} else { } else {
self.handler.cancel_msgbox(&format!( self.handler.cancel_msgbox(&format!(
@ -1370,6 +1372,7 @@ impl<T: InvokeUiSession> Remote<T> {
if err.is_empty() { if err.is_empty() {
self.handler.msgbox("wait-uac", "", "", ""); self.handler.msgbox("wait-uac", "", "", "");
} else { } else {
self.handler.cancel_msgbox("wait-uac");
self.handler self.handler
.msgbox("elevation-error", "Elevation Error", &err, ""); .msgbox("elevation-error", "Elevation Error", &err, "");
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "启动时检查软件更新"), ("Check for software update on startup", "启动时检查软件更新"),
("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"), ("upgrade_rustdesk_server_pro_to_{}_tip", "请升级专业版服务器到{}或更高版本!"),
("pull_group_failed_tip", "获取组信息失败"), ("pull_group_failed_tip", "获取组信息失败"),
("No permission", "没有权限"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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"), ("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!"), ("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"), ("pull_group_failed_tip", "Aktualisierung der Gruppe fehlgeschlagen"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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"), ("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"), ("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"), ("pull_group_failed_tip", "No se ha podido refrescar el grupo"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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"), ("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 !"), ("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"), ("pull_group_failed_tip", "Échec de l'actualisation du groupe"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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."), ("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!"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Silahkan perbarui RustDesk Server Pro ke versi {} atau yang lebih baru!"),
("pull_group_failed_tip", "Gagal memperbarui grup"), ("pull_group_failed_tip", "Gagal memperbarui grup"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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"), ("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!"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Aggiorna RustDesk Server Pro alla versione {} o successiva!"),
("pull_group_failed_tip", "Impossibile aggiornare il gruppo"), ("pull_group_failed_tip", "Impossibile aggiornare il gruppo"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -57,7 +57,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("ID Server", "ID serveris"), ("ID Server", "ID serveris"),
("Relay Server", "Releja serveris"), ("Relay Server", "Releja serveris"),
("API Server", "API serveris"), ("API Server", "API serveris"),
("Key", "Atslēga"),
("invalid_http", "jāsākas ar http:// vai https://"), ("invalid_http", "jāsākas ar http:// vai https://"),
("Invalid IP", "Nederīga IP"), ("Invalid IP", "Nederīga IP"),
("Invalid format", "Nederīgs formāts"), ("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?"), ("This file exists, skip or overwrite this file?", "Šis fails pastāv, izlaist vai pārrakstīt šo failu?"),
("Quit", "Iziet"), ("Quit", "Iziet"),
("doc_mac_permission", "https://rustdesk.com/docs/en/manual/mac/#enable-permissions"), ("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"), ("Help", "Palīdzība"),
("Failed", "Neizdevās"), ("Failed", "Neizdevās"),
("Succeeded", "Izdevās"), ("Succeeded", "Izdevās"),
@ -481,7 +479,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Me", "Es"), ("Me", "Es"),
("identical_file_tip", "Šis fails ir identisks sesijas failam."), ("identical_file_tip", "Šis fails ir identisks sesijas failam."),
("show_monitors_tip", "Rādīt monitorus rīkjoslā"), ("show_monitors_tip", "Rādīt monitorus rīkjoslā"),
("enter_rustdesk_passwd_tip", "Ievadiet RustDesk paroli"),
("View Mode", "Skatīšanas režīms"), ("View Mode", "Skatīšanas režīms"),
("login_linux_tip", "Jums ir jāpiesakās attālajā Linux kontā, lai iespējotu X darbvirsmas sesiju"), ("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"), ("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"), ("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!"), ("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"), ("pull_group_failed_tip", "Neizdevās atsvaidzināt grupu"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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"), ("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!"), ("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"), ("pull_group_failed_tip", "Błąd odświeżania grup"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", "Проверять обновления программы при запуске"), ("Check for software update on startup", "Проверять обновления программы при запуске"),
("upgrade_rustdesk_server_pro_to_{}_tip", "Обновите RustDesk Server Pro до версии {} или новее!"), ("upgrade_rustdesk_server_pro_to_{}_tip", "Обновите RustDesk Server Pro до версии {} или новее!"),
("pull_group_failed_tip", "Невозможно обновить группу"), ("pull_group_failed_tip", "Невозможно обновить группу"),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -557,5 +557,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Check for software update on startup", ""), ("Check for software update on startup", ""),
("upgrade_rustdesk_server_pro_to_{}_tip", ""), ("upgrade_rustdesk_server_pro_to_{}_tip", ""),
("pull_group_failed_tip", ""), ("pull_group_failed_tip", ""),
("No permission", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -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> { pub fn is_foreground_window_elevated() -> ResultType<bool> {
unsafe { unsafe {
let mut process_id: DWORD = 0; let mut process_id: DWORD = 0;
@ -1617,12 +1594,7 @@ pub fn is_foreground_window_elevated() -> ResultType<bool> {
if process_id == 0 { if process_id == 0 {
bail!("Failed to get processId, errno {}", GetLastError()) bail!("Failed to get processId, errno {}", GetLastError())
} }
let elevated = is_elevated(Some(process_id))?; is_elevated(Some(process_id))
if elevated {
filter_foreground_window(process_id)
} else {
Ok(false)
}
} }
} }

View File

@ -2047,12 +2047,18 @@ impl Connection {
#[cfg(windows)] #[cfg(windows)]
async fn handle_elevation_request(&mut self, para: portable_client::StartPara) { async fn handle_elevation_request(&mut self, para: portable_client::StartPara) {
let mut err = "No need to elevate".to_string(); let mut err;
if !crate::platform::is_installed() && !portable_client::running() { if !self.keyboard {
err = portable_client::start_portable_service(para) err = "No permission".to_string();
.err() } else {
.map_or("".to_string(), |e| e.to_string()); 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(); let mut misc = Misc::new();
misc.set_elevation_response(err); misc.set_elevation_response(err);
let mut msg = Message::new(); let mut msg = Message::new();
@ -2369,6 +2375,7 @@ impl Connection {
if self.portable.is_installed if self.portable.is_installed
|| self.file_transfer.is_some() || self.file_transfer.is_some()
|| self.port_forward_socket.is_some() || self.port_forward_socket.is_some()
|| !self.keyboard
{ {
return; return;
} }