Merge pull request #5873 from 21pages/cm_width

opt cm width and elevation requires keyboard permission
This commit is contained in:
RustDesk 2023-10-01 12:49:20 +08:00 committed by GitHub
commit 6e3e60a44d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 115 additions and 75 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

@ -175,11 +175,31 @@ class ConnectionManagerState extends State<ConnectionManager> {
], ],
); );
}, },
pageViewBuilder: (pageView) => Row( pageViewBuilder: (pageView) => LayoutBuilder(
children: [ 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>( Consumer<ChatModel>(
builder: (_, model, child) => model.isShowCMSidePage builder: (_, model, child) => SizedBox(
? Expanded( width: realChatPageWidth,
child: buildRemoteBlock( child: buildRemoteBlock(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -189,20 +209,13 @@ class ConnectionManagerState extends State<ConnectionManager> {
.dividerColor))), .dividerColor))),
child: buildSidePage()), child: buildSidePage()),
), ),
flex: (kConnectionManagerWindowSizeOpenChat.width - )),
kConnectionManagerWindowSizeClosedChat SizedBox(
.width) width: realClosedWidth,
.toInt(), child:
) SizedBox(width: realClosedWidth, child: pageView)),
: Offstage(), ]);
), },
Expanded(
child: pageView,
flex: kConnectionManagerWindowSizeClosedChat.width
.toInt() -
4 // prevent stretch of the page view when chat is open,
),
],
), ),
), ),
); );
@ -966,8 +979,7 @@ class __FileTransferLogPageState extends State<_FileTransferLogPage> {
return PreferredSize( return PreferredSize(
preferredSize: const Size(200, double.infinity), preferredSize: const Size(200, double.infinity),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), padding: const EdgeInsets.all(12.0),
padding: const EdgeInsets.all(8.0),
child: Obx( child: Obx(
() { () {
final jobTable = gFFI.cmFileModel.currentJobTable; final jobTable = gFFI.cmFileModel.currentJobTable;

View File

@ -285,7 +285,10 @@ class ChatModel with ChangeNotifier {
await toggleCMSidePage(); await toggleCMSidePage();
} }
var _togglingCMSidePage = false; // protect order for await
toggleCMSidePage() async { toggleCMSidePage() async {
if (_togglingCMSidePage) return false;
_togglingCMSidePage = true;
if (_isShowCMSidePage) { if (_isShowCMSidePage) {
_isShowCMSidePage = !_isShowCMSidePage; _isShowCMSidePage = !_isShowCMSidePage;
notifyListeners(); notifyListeners();
@ -300,6 +303,7 @@ class ChatModel with ChangeNotifier {
_isShowCMSidePage = !_isShowCMSidePage; _isShowCMSidePage = !_isShowCMSidePage;
notifyListeners(); notifyListeners();
} }
_togglingCMSidePage = false;
} }
changeCurrentKey(MessageKey key) { changeCurrentKey(MessageKey key) {

View File

@ -1318,9 +1318,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",
@ -1339,7 +1340,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!(
@ -1350,9 +1351,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",
@ -1371,7 +1373,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!(
@ -1385,6 +1387,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 !self.keyboard {
err = "No permission".to_string();
} else {
err = "No need to elevate".to_string();
if !crate::platform::is_installed() && !portable_client::running() { if !crate::platform::is_installed() && !portable_client::running() {
err = portable_client::start_portable_service(para) err = portable_client::start_portable_service(para)
.err() .err()
.map_or("".to_string(), |e| e.to_string()); .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;
} }