diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 93fe0fee..483aba38 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -627,7 +627,7 @@ class CustomAlertDialog extends StatelessWidget { } } -void msgBox(String type, String title, String text, String link, +void msgBox(String id, String type, String title, String text, String link, OverlayDialogManager dialogManager, {bool? hasCancel}) { dialogManager.dismissAll(); @@ -672,14 +672,17 @@ void msgBox(String type, String title, String text, String link, if (link.isNotEmpty) { buttons.insert(0, msgBoxButton(translate('JumpLink'), jumplink)); } - dialogManager.show((setState, close) => CustomAlertDialog( - title: _msgBoxTitle(title), - content: SelectableText(translate(text), - style: const TextStyle(fontSize: 15)), - actions: buttons, - onSubmit: hasOk ? submit : null, - onCancel: hasCancel == true ? cancel : null, - )); + dialogManager.show( + (setState, close) => CustomAlertDialog( + title: _msgBoxTitle(title), + content: + SelectableText(translate(text), style: const TextStyle(fontSize: 15)), + actions: buttons, + onSubmit: hasOk ? submit : null, + onCancel: hasCancel == true ? cancel : null, + ), + tag: '$id-$type-$title-$text-$link', + ); } Widget msgBoxButton(String text, void Function() onPressed) { diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 2b8c9994..dae3fa61 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -163,7 +163,7 @@ class _RemotePageState extends State super.build(context); return WillPopScope( onWillPop: () async { - clientClose(_ffi.dialogManager); + clientClose(widget.id, _ffi.dialogManager); return false; }, child: MultiProvider(providers: [ diff --git a/flutter/lib/desktop/widgets/remote_menubar.dart b/flutter/lib/desktop/widgets/remote_menubar.dart index 75311c4c..cdbeb0be 100644 --- a/flutter/lib/desktop/widgets/remote_menubar.dart +++ b/flutter/lib/desktop/widgets/remote_menubar.dart @@ -489,7 +489,7 @@ class _RemoteMenubarState extends State { return IconButton( tooltip: translate('Close'), onPressed: () { - clientClose(widget.ffi.dialogManager); + clientClose(widget.id, widget.ffi.dialogManager); }, icon: const Icon( Icons.close, diff --git a/flutter/lib/mobile/pages/file_manager_page.dart b/flutter/lib/mobile/pages/file_manager_page.dart index 3221cdba..6e5c9148 100644 --- a/flutter/lib/mobile/pages/file_manager_page.dart +++ b/flutter/lib/mobile/pages/file_manager_page.dart @@ -63,7 +63,8 @@ class _FileManagerPageState extends State { leading: Row(children: [ IconButton( icon: Icon(Icons.close), - onPressed: () => clientClose(gFFI.dialogManager)), + onPressed: () => + clientClose(widget.id, gFFI.dialogManager)), ]), centerTitle: true, title: ToggleSwitch( diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 07304d2d..719b7dc2 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -223,7 +223,7 @@ class _RemotePageState extends State { return WillPopScope( onWillPop: () async { - clientClose(gFFI.dialogManager); + clientClose(widget.id, gFFI.dialogManager); return false; }, child: getRawPointerAndKeyBody(Scaffold( @@ -304,7 +304,7 @@ class _RemotePageState extends State { color: Colors.white, icon: Icon(Icons.clear), onPressed: () { - clientClose(gFFI.dialogManager); + clientClose(widget.id, gFFI.dialogManager); }, ) ] + diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart index 03b36ecf..96f96658 100644 --- a/flutter/lib/mobile/widgets/dialog.dart +++ b/flutter/lib/mobile/widgets/dialog.dart @@ -5,9 +5,9 @@ import '../../common.dart'; import '../../models/model.dart'; import '../../models/platform_model.dart'; -void clientClose(OverlayDialogManager dialogManager) { - msgBox( - '', 'Close', 'Are you sure to close the connection?', '', dialogManager); +void clientClose(String id, OverlayDialogManager dialogManager) { + msgBox(id, '', 'Close', 'Are you sure to close the connection?', '', + dialogManager); } void showSuccess() { diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index fb4f8b4f..a39bc7d0 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -195,6 +195,8 @@ class FfiModel with ChangeNotifier { } else if (name == 'show_elevation') { final show = evt['show'].toString() == 'true'; parent.target?.serverModel.setShowElevation(show); + } else if (name == 'cancel_msgbox') { + cancelMsgBox(evt, peerId); } }; } @@ -231,6 +233,13 @@ class FfiModel with ChangeNotifier { notifyListeners(); } + cancelMsgBox(Map evt, String id) { + if (parent.target == null) return; + final dialogManager = parent.target!.dialogManager; + final tag = '$id-${evt['tag']}'; + dialogManager.dismissByTag(tag); + } + /// Handle the message box event based on [evt] and [id]. handleMsgBox(Map evt, String id) { if (parent.target == null) return; @@ -256,7 +265,7 @@ class FfiModel with ChangeNotifier { showMsgBox(String id, String type, String title, String text, String link, bool hasRetry, OverlayDialogManager dialogManager, {bool? hasCancel}) { - msgBox(type, title, text, link, dialogManager, hasCancel: hasCancel); + msgBox(id, type, title, text, link, dialogManager, hasCancel: hasCancel); _timer?.cancel(); if (hasRetry) { _timer = Timer(Duration(seconds: _reconnects), () { diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index 04d1d4d2..6eb44310 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -20,18 +20,14 @@ use hbb_common::fs::{ use hbb_common::message_proto::permission_info::Permission; use hbb_common::protobuf::Message as _; use hbb_common::rendezvous_proto::ConnType; +#[cfg(windows)] +use hbb_common::tokio::sync::Mutex as TokioMutex; use hbb_common::tokio::{ self, sync::mpsc, time::{self, Duration, Instant, Interval}, }; -#[cfg(windows)] -use hbb_common::tokio::sync::Mutex as TokioMutex; -use hbb_common::{ - allow_err, - message_proto::*, - sleep, -}; +use hbb_common::{allow_err, message_proto::*, sleep}; use hbb_common::{fs, log, Stream}; use std::collections::HashMap; @@ -998,23 +994,31 @@ impl Remote { } } Some(misc::Union::Uac(uac)) => { + let msgtype = "custom-uac-nocancel"; + let title = "Prompt"; + let text = "Please wait for confirmation of UAC..."; + let link = ""; if uac { - self.handler.msgbox( - "custom-uac-nocancel", - "Warning", - "uac_warning", - "", - ); + self.handler.msgbox(msgtype, title, text, link); + } else { + self.handler + .cancel_msgbox( + &format!("{}-{}-{}-{}", msgtype, title, text, link,), + ); } } Some(misc::Union::ForegroundWindowElevated(elevated)) => { + let msgtype = "custom-elevated-foreground-nocancel"; + let title = "Prompt"; + let text = "elevated_foreground_window_tip"; + let link = ""; if elevated { - self.handler.msgbox( - "custom-elevated-foreground-nocancel", - "Warning", - "elevated_foreground_window_warning", - "", - ); + self.handler.msgbox(msgtype, title, text, link); + } else { + self.handler + .cancel_msgbox( + &format!("{}-{}-{}-{}", msgtype, title, text, link,), + ); } } _ => {} diff --git a/src/flutter.rs b/src/flutter.rs index a69473e5..9c420862 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -228,8 +228,7 @@ impl InvokeUiSession for FlutterHandler { id: i32, entries: &Vec, path: String, - #[allow(unused_variables)] - is_local: bool, + #[allow(unused_variables)] is_local: bool, only_count: bool, ) { // TODO opt @@ -327,6 +326,10 @@ impl InvokeUiSession for FlutterHandler { ); } + fn cancel_msgbox(&self, tag: &str) { + self.push_event("cancel_msgbox", vec![("tag", tag)]); + } + fn new_message(&self, msg: String) { self.push_event("chat_client_mode", vec![("text", &msg)]); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index b622123a..68c5dbf6 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "拒绝局域网发现"), ("Write a message", "输入聊天消息"), ("Prompt", "提示"), - ("elevation_prompt", "以当前用户权限运行软件,可能导致远端在访问本机时,没有足够的权限来操作部分窗口。"), - ("uac_warning", "暂时无法访问远端设备,因为远端设备正在请求用户账户权限,请等待对方关闭UAC窗口。为避免这个问题,建议在远端设备上安装或者以管理员权限运行本软件。"), - ("elevated_foreground_window_warning", "暂时无法使用鼠标键盘,因为远端桌面的当前窗口需要更高的权限才能操作, 可以请求对方最小化当前窗口。为避免这个问题,建议在远端设备上安装或者以管理员权限运行本软件。"), + ("Please wait for confirmation of UAC...", "请等待对方确认UAC..."), + ("elevated_foreground_window_tip", "远端桌面的当前窗口需要更高的权限才能操作, 暂时无法使用鼠标键盘, 可以请求对方最小化当前窗口, 或者在连接管理窗口点击提升。为避免这个问题,建议在远端设备上安装本软件。"), ("Disconnected", "会话已结束"), ("Other", "其他"), ("Confirm before closing multiple tabs", "关闭多个标签页时向您确认"), diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 5c086bfb..98bb9c5d 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/da.rs b/src/lang/da.rs index 90670804..b98e5ba3 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Afvis LAN Discovery"), ("Write a message", "Skriv en besked"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Afbrudt"), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/de.rs b/src/lang/de.rs index 6ebea6b2..1e808391 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "LAN-Erkennung verbieten"), ("Write a message", "Nachricht schreiben"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/en.rs b/src/lang/en.rs index 3415fa46..ee68d443 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -30,9 +30,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("android_open_battery_optimizations_tip", "If you want to disable this feature, please go to the next RustDesk application settings page, find and enter [Battery], Uncheck [Unrestricted]"), ("remote_restarting_tip", "Remote device is restarting, please close this message box and reconnect with permanent password after a while"), ("Are you sure to close the connection?", "Are you sure you want to close the connection?"), - ("elevation_prompt", "Running software without privilege elevation may cause problems when remote users operate certain windows."), - ("uac_warning", "Temporarily denied access due to elevation request, please wait for the remote user to accept the UAC dialog. To avoid this problem, it is recommended to install the software on the remote device or run it with administrator privileges."), - ("elevated_foreground_window_warning", "Temporarily unable to use the mouse and keyboard, because the current window of the remote desktop requires higher privilege to operate, you can request the remote user to minimize the current window. To avoid this problem, it is recommended to install the software on the remote device or run it with administrator privileges."), + ("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"), ("Stop service", "Stop Service"), ("or", ""), diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 2dce72f6..93394a91 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/es.rs b/src/lang/es.rs index 2e70a519..a00009b7 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Denegar descubrimiento de LAN"), ("Write a message", "Escribir un mensaje"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Desconectado"), ("Other", "Otro"), ("Confirm before closing multiple tabs", "Confirmar antes de cerrar múltiples pestañas"), diff --git a/src/lang/fa.rs b/src/lang/fa.rs index f9a15dc9..b6c3d002 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "غیر فعالسازی جستجو در شبکه"), ("Write a message", "یک پیام بنویسید"), ("Prompt", ""), - ("elevation_prompt", "اجرای نرم‌افزار بدون افزایش امتیاز می‌تواند باعث ایجاد مشکلاتی در هنگام کار کردن کاربران راه دور با ویندوزهای خاص شود"), - ("uac_warning", "به دلیل درخواست دسترسی سطح بالا، به طور موقت از دسترسی رد شد. منتظر بمانید تا کاربر راه دور گفتگوی UAC را بپذیرد. برای جلوگیری از این مشکل، توصیه می شود نرم افزار را روی دستگاه از راه دور نصب کنید یا آن را با دسترسی مدیر اجرا کنید."), - ("elevated_foreground_window_warning", "به طور موقت استفاده از ماوس و صفحه کلید امکان پذیر نیست زیرا پنجره دسکتاپ از راه دور فعلی برای کار کردن به دسترسی های بالاتر نیاز دارد، می توانید از کاربر راه دور بخواهید که پنجره فعلی را به حداقل برساند. برای جلوگیری از این مشکل، توصیه می شود نرم افزار را روی یک دستگاه راه دور نصب کنید یا آن را با دسترسی مدیر اجرا کنید"), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "قطع ارتباط"), ("Other", "دیگر"), ("Confirm before closing multiple tabs", "بستن چندین برگه را تأیید کنید"), diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 811ec911..ff4e2e08 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Interdir la découverte réseau local"), ("Write a message", "Ecrire un message"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Déconnecté"), ("Other", "Divers"), ("Confirm before closing multiple tabs", "Confirmer avant de fermer plusieurs onglets"), diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 863fa373..9bd5de21 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Felfedezés tiltása"), ("Write a message", "Üzenet írása"), ("Prompt", ""), - ("elevation_prompt", "A szoftver jogosultságnövelés nélküli futtatása problémákat okozhat, ha távoli felhasználók bizonyos ablakokat működtetnek."), - ("uac_warning", "Kérjük, várja meg, amíg a távoli felhasználó elfogadja az UAC párbeszédpanelt. A probléma elkerülése érdekében javasoljuk, hogy telepítse a szoftvert a távoli eszközre, vagy futtassa rendszergazdai jogosultságokkal."), - ("elevated_foreground_window_warning", "Átmenetileg nem tudja használni az egeret és a billentyűzetet, mert a távoli asztal aktuális ablakának működéséhez magasabb jogosultság szükséges, ezért kérheti a távoli felhasználót, hogy minimalizálja az aktuális ablakot. A probléma elkerülése érdekében javasoljuk, hogy telepítse a szoftvert a távoli eszközre, vagy futtassa rendszergazdai jogosultságokkal."), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Szétkapcsolva"), ("Other", "Egyéb"), ("Confirm before closing multiple tabs", "Biztos, hogy bezárja az összes lapot?"), diff --git a/src/lang/id.rs b/src/lang/id.rs index 78fccc9f..7d4ae163 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Tolak Penemuan LAN"), ("Write a message", "Menulis pesan"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Terputus"), ("Other", "Lainnya"), ("Confirm before closing multiple tabs", "Konfirmasi sebelum menutup banyak tab"), diff --git a/src/lang/it.rs b/src/lang/it.rs index 35c09a0b..3490a9b7 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 21344eb1..2953f80c 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", "他の"), ("Confirm before closing multiple tabs", "同時に複数のタブを閉じる前に確認する"), diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 3b726902..2473ef2d 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 1dc50580..1ce728db 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 7ed98913..3bcc464c 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Zablokuj Wykrywanie LAN"), ("Write a message", "Napisz wiadomość"), ("Prompt", "Monit"), - ("elevation_prompt", "Monit o podwyższeniu uprawnień"), - ("uac_warning", "Ostrzeżenie UAC"), - ("elevated_foreground_window_warning", "Pierwszoplanowe okno ostrzeżenia o podwyższeniu uprawnień"), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Rozłączone"), ("Other", "Inne"), ("Confirm before closing multiple tabs", "Potwierdź przed zamknięciem wielu kart"), diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 8b4c980f..e7bb0e73 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Desconectado"), ("Other", "Outro"), ("Confirm before closing multiple tabs", "Confirme antes de fechar vários separadores"), diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 0d5594ea..bc35cfcb 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Negar descoberta da LAN"), ("Write a message", "Escrever uma mensagem"), ("Prompt", "Prompt de comando"), - ("elevation_prompt", "Prompt de comando (Admin)"), - ("uac_warning", "Aviso UAC"), - ("elevated_foreground_window_warning", "Aviso de janela de primeiro plano elevado"), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Desconectado"), ("Other", "Outro"), ("Confirm before closing multiple tabs", "Confirmar antes de fechar múltiplas abas"), diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 22c246f8..9e9a6082 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Запретить обнаружение в локальной сети"), ("Write a message", "Написать сообщение"), ("Prompt", "Подсказка"), - ("elevation_prompt", "Запуск программного обеспечения без повышения привилегий может вызвать проблемы, когда удалённые пользователи работают с определёнными окнами."), - ("uac_warning", "Временно отказано в доступе из-за запроса на повышение прав. Подождите, пока удалённый пользователь примет диалоговое окно UAC. Чтобы избежать этой проблемы, рекомендуется устанавливать программное обеспечение на удалённое устройство или запускать его с правами администратора."), - ("elevated_foreground_window_warning", "Временно невозможно использовать мышь и клавиатуру, поскольку текущее окно удалённого рабочего стола требует более высоких привилегий для работы, вы можете попросить удалённого пользователя свернуть текущее окно. Чтобы избежать этой проблемы, рекомендуется устанавливать программное обеспечение на удалённое устройство или запускать его с правами администратора."), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", "Отключено"), ("Other", "Другое"), ("Confirm before closing multiple tabs", "Подтверждение закрытия несколько вкладок"), diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 618ede5c..3970ef3b 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/template.rs b/src/lang/template.rs index 4ff8f9b8..d9fd7b9b 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 6fb89a09..cd2c8b26 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 1150199c..da57cf07 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "拒絕局域網發現"), ("Write a message", "輸入聊天消息"), ("Prompt", "提示"), - ("elevation_prompt", "以當前用戶權限運行軟件,可能導致遠端在訪問本機時,沒有足夠的權限來操作部分窗口。"), - ("uac_warning", "暂时无法访问远端设备,因为远端设备正在请求用户账户权限,请等待对方关闭UAC窗口。为避免这个问题,建议在远端设备上安装或者以管理员权限运行本软件。"), - ("elevated_foreground_window_warning", "暫時無法使用鼠標鍵盤,因為遠端桌面的當前窗口需要更高的權限才能操作, 可以請求對方最小化當前窗口。為避免這個問題,建議在遠端設備上安裝或者以管理員權限運行本軟件。"), + ("Please wait for confirmation of UAC...", "請等待對方確認UAC"), + ("elevated_foreground_window_tip", "遠端桌面的當前窗口需要更高的權限才能操作, 暫時無法使用鼠標鍵盤, 可以請求對方最小化當前窗口, 或者在連接管理窗口點擊提升。為避免這個問題,建議在遠端設備上安裝本軟件。"), ("Disconnected", "會話已結束"), ("Other", "其他"), ("Confirm before closing multiple tabs", "關閉多個分頁前跟我確認"), diff --git a/src/lang/ua.rs b/src/lang/ua.rs index cc0ef653..10119d1e 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", "Заборонити виявлення локальної мережі"), ("Write a message", "Написати повідомлення"), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 9773d765..8bb164a8 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -371,9 +371,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Deny LAN Discovery", ""), ("Write a message", ""), ("Prompt", ""), - ("elevation_prompt", ""), - ("uac_warning", ""), - ("elevated_foreground_window_warning", ""), + ("Please wait for confirmation of UAC...", ""), + ("elevated_foreground_window_tip", ""), ("Disconnected", ""), ("Other", ""), ("Confirm before closing multiple tabs", ""), diff --git a/src/server/connection.rs b/src/server/connection.rs index 8674c6d9..cb2ddc2c 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -26,12 +26,9 @@ use hbb_common::{ use scrap::android::call_main_service_mouse_input; use serde_json::{json, value::Value}; use sha2::{Digest, Sha256}; -use std::sync::{ - atomic::AtomicI64, - mpsc as std_mpsc, -}; #[cfg(not(any(target_os = "android", target_os = "ios")))] use std::sync::atomic::Ordering; +use std::sync::{atomic::AtomicI64, mpsc as std_mpsc}; #[cfg(not(any(target_os = "android", target_os = "ios")))] use system_shutdown; @@ -434,7 +431,7 @@ impl Connection { let uac = crate::video_service::IS_UAC_RUNNING.lock().unwrap().clone(); if last_uac != uac { last_uac = uac; - if !portable_service_running { + if !uac || !portable_service_running{ let mut misc = Misc::new(); misc.set_uac(uac); let mut msg = Message::new(); @@ -445,7 +442,7 @@ impl Connection { let foreground_window_elevated = crate::video_service::IS_FOREGROUND_WINDOW_ELEVATED.lock().unwrap().clone(); if last_foreground_window_elevated != foreground_window_elevated { last_foreground_window_elevated = foreground_window_elevated; - if !portable_service_running { + if !foreground_window_elevated || !portable_service_running { let mut misc = Misc::new(); misc.set_foreground_window_elevated(foreground_window_elevated); let mut msg = Message::new(); diff --git a/src/ui/common.tis b/src/ui/common.tis index 76e0fb84..7507d489 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -232,6 +232,7 @@ class ChatBox: Reactor.Component { /******************** start of msgbox ****************************************/ var remember_password = false; +var last_msgbox_tag = ""; function msgbox(type, title, content, link="", callback=null, height=180, width=500, hasRetry=false, contentStyle="") { $(body).scrollTo(0, 0); if (!type) { @@ -264,6 +265,7 @@ function msgbox(type, title, content, link="", callback=null, height=180, width= } else if (type.indexOf("custom") < 0 && !is_port_forward && !callback) { callback = function() { view.close(); } } + last_msgbox_tag = type + "-" + title + "-" + content + "-" + link; $(#msgbox).content(); } @@ -276,6 +278,12 @@ handler.msgbox = function(type, title, text, link = "", hasRetry=false) { self.timer(60ms, function() { msgbox(type, title, text, link, null, 180, 500, hasRetry); }); } +handler.cancel_msgbox = function(tag) { + if (last_msgbox_tag == tag) { + closeMsgbox(); + } +} + var reconnectTimeout = 1000; handler.msgbox_retry = function(type, title, text, link, hasRetry) { handler.msgbox(type, title, text, link, hasRetry); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 62df8525..66b46cf8 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -231,7 +231,14 @@ impl InvokeUiSession for SciterHandler { } fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str, retry: bool) { - self.call2("msgbox_retry", &make_args!(msgtype, title, text, link, retry)); + self.call2( + "msgbox_retry", + &make_args!(msgtype, title, text, link, retry), + ); + } + + fn cancel_msgbox(&self, tag: &str) { + self.call("cancel_msgbox", &make_args!(tag)); } fn new_message(&self, msg: String) { diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 4467fee0..5119a6e1 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -1,11 +1,11 @@ -#[cfg(not(any(target_os = "android", target_os = "ios")))] -use crate::client::{get_key_state, SERVER_KEYBOARD_ENABLED}; use crate::client::io_loop::Remote; use crate::client::{ check_if_retry, handle_hash, handle_login_from_ui, handle_test_delay, input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key, LoginConfigHandler, QualityStatus, KEY_MAP, }; +#[cfg(not(any(target_os = "android", target_os = "ios")))] +use crate::client::{get_key_state, SERVER_KEYBOARD_ENABLED}; #[cfg(target_os = "linux")] use crate::common::IS_X11; use crate::{client::Data, client::Interface}; @@ -15,9 +15,9 @@ use hbb_common::rendezvous_proto::ConnType; use hbb_common::tokio::{self, sync::mpsc}; use hbb_common::{allow_err, message_proto::*}; use hbb_common::{fs, get_version_number, log, Stream}; +use rdev::{Event, EventType, EventType::*, Key as RdevKey}; #[cfg(not(any(target_os = "android", target_os = "ios")))] use rdev::{Keyboard as RdevKeyboard, KeyboardState}; -use rdev::{Event, EventType, EventType::*, Key as RdevKey}; use std::collections::{HashMap, HashSet}; use std::ops::{Deref, DerefMut}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; @@ -1120,6 +1120,7 @@ pub trait InvokeUiSession: Send + Sync + Clone + 'static + Sized + Default { fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str, retry: bool); #[cfg(any(target_os = "android", target_os = "ios"))] fn clipboard(&self, content: String); + fn cancel_msgbox(&self, tag: &str); } impl Deref for Session {