elevation prompt && uac warning
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
e1c2b8de6e
commit
728985e3bf
@ -407,6 +407,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(const Duration(seconds: 1), () async {
|
||||
final installed = bind.mainIsInstalled();
|
||||
final root = await bind.mainIsRoot();
|
||||
final release = await bind.mainIsRelease();
|
||||
if (Platform.isWindows && release && !installed && !root) {
|
||||
msgBox('custom-elevation-nocancel', 'Prompt', 'elevation_prompt',
|
||||
gFFI.dialogManager);
|
||||
}
|
||||
});
|
||||
Timer(const Duration(seconds: 5), () async {
|
||||
updateUrl = await bind.mainGetSoftwareUpdateUrl();
|
||||
if (updateUrl.isNotEmpty) setState(() {});
|
||||
|
@ -556,6 +556,7 @@ message Misc {
|
||||
bool video_received = 12;
|
||||
BackNotification back_notification = 13;
|
||||
bool restart_remote_device = 14;
|
||||
bool uac = 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -979,6 +979,12 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Some(misc::Union::Uac(uac)) => {
|
||||
if uac {
|
||||
self.handler
|
||||
.msgbox("custom-uac-nocancel", "Warning", "uac_warning");
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
Some(message::Union::TestDelay(t)) => {
|
||||
|
@ -800,6 +800,14 @@ pub fn main_has_hwcodec() -> SyncReturn<bool> {
|
||||
SyncReturn(has_hwcodec())
|
||||
}
|
||||
|
||||
pub fn main_is_root() -> bool {
|
||||
is_root()
|
||||
}
|
||||
|
||||
pub fn main_is_release() -> bool {
|
||||
is_release()
|
||||
}
|
||||
|
||||
pub fn session_send_mouse(id: String, msg: String) {
|
||||
if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(&msg) {
|
||||
let alt = m.get("alt").is_some();
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", "允许局域网发现"),
|
||||
("Deny LAN Discovery", "拒绝局域网发现"),
|
||||
("Write a message", "输入聊天消息"),
|
||||
("Prompt", "提示"),
|
||||
("elevation_prompt", "以当前用户权限运行软件,可能导致远端在访问本机时,没有足够的权限来操作部分窗口。"),
|
||||
("uac_warning", "暂时无法访问远端设备,因为远端设备正在请求用户账户权限,请等待对方关闭UAC窗口。为避免这个问题,建议在远端设备上安装或者以管理员权限运行本软件。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -30,5 +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."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -359,5 +359,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", "允許局域網發現"),
|
||||
("Deny LAN Discovery", "拒絕局域網發現"),
|
||||
("Write a message", "輸入聊天消息"),
|
||||
("Prompt", "提示"),
|
||||
("elevation_prompt", "以當前用戶權限運行軟件,可能導致遠端在訪問本機時,沒有足夠的權限來操作部分窗口。"),
|
||||
("uac_warning", "暂时无法访问远端设备,因为远端设备正在请求用户账户权限,请等待对方关闭UAC窗口。为避免这个问题,建议在远端设备上安装或者以管理员权限运行本软件。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -360,5 +360,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Enable LAN Discovery", ""),
|
||||
("Deny LAN Discovery", ""),
|
||||
("Write a message", ""),
|
||||
("Prompt", ""),
|
||||
("elevation_prompt", ""),
|
||||
("uac_warning", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -229,6 +229,8 @@ impl Connection {
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
std::thread::spawn(move || Self::handle_input(rx_input, tx_cloned));
|
||||
let mut second_timer = time::interval(Duration::from_secs(1));
|
||||
let mut uac = false;
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
@ -400,6 +402,19 @@ impl Connection {
|
||||
break;
|
||||
}
|
||||
},
|
||||
_ = second_timer.tick() => {
|
||||
let is_uac = crate::video_service::IS_UAC_RUNNING.lock().unwrap().clone();
|
||||
if uac != is_uac {
|
||||
if !crate::platform::is_installed() && !crate::platform::is_root() {
|
||||
uac = is_uac;
|
||||
let mut misc = Misc::new();
|
||||
misc.set_uac(uac);
|
||||
let mut msg = Message::new();
|
||||
msg.set_misc(misc);
|
||||
conn.inner.send(msg.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = test_delay_timer.tick() => {
|
||||
if last_recv_time.elapsed() >= SEC30 {
|
||||
conn.on_close("Timeout", true).await;
|
||||
|
@ -33,6 +33,7 @@ use std::{
|
||||
collections::HashSet,
|
||||
io::ErrorKind::WouldBlock,
|
||||
ops::{Deref, DerefMut},
|
||||
sync::Once,
|
||||
time::{self, Duration, Instant},
|
||||
};
|
||||
#[cfg(windows)]
|
||||
@ -51,6 +52,7 @@ lazy_static::lazy_static! {
|
||||
static ref PRIVACY_MODE_CONN_ID: Mutex<i32> = Mutex::new(0);
|
||||
static ref IS_CAPTURER_MAGNIFIER_SUPPORTED: bool = is_capturer_mag_supported();
|
||||
pub static ref VIDEO_QOS: Arc<Mutex<VideoQoS>> = Default::default();
|
||||
pub static ref IS_UAC_RUNNING: Arc<Mutex<bool>> = Default::default();
|
||||
}
|
||||
|
||||
fn is_capturer_mag_supported() -> bool {
|
||||
@ -451,6 +453,8 @@ fn run(sp: GenericService) -> ResultType<()> {
|
||||
};
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
let recorder: Arc<Mutex<Option<Recorder>>> = Default::default();
|
||||
#[cfg(windows)]
|
||||
start_uac_check();
|
||||
|
||||
while sp.ok() {
|
||||
#[cfg(windows)]
|
||||
@ -832,3 +836,18 @@ pub(super) fn get_current_display_2(mut all: Vec<Display>) -> ResultType<(usize,
|
||||
fn get_current_display() -> ResultType<(usize, usize, Display)> {
|
||||
get_current_display_2(try_get_displays()?)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn start_uac_check() {
|
||||
static START: Once = Once::new();
|
||||
START.call_once(|| {
|
||||
if !crate::platform::is_installed() && !crate::platform::is_root() {
|
||||
std::thread::spawn(|| loop {
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
if let Ok(uac) = crate::ui::win_privacy::is_process_consent_running() {
|
||||
*IS_UAC_RUNNING.lock().unwrap() = uac;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
27
src/ui.rs
27
src/ui.rs
@ -20,22 +20,7 @@ use hbb_common::{
|
||||
|
||||
use crate::common::get_app_name;
|
||||
use crate::ipc;
|
||||
use crate::ui_interface::{
|
||||
check_mouse_time, closing, create_shortcut, current_is_wayland, default_video_save_directory,
|
||||
fix_login_wayland, forget_password, get_api_server, get_async_job_status, get_connect_status,
|
||||
get_error, get_fav, get_icon, get_lan_peers, get_langs, get_license, get_local_option,
|
||||
get_mouse_time, get_new_version, get_option, get_options, get_peer, get_peer_option,
|
||||
get_recent_sessions, get_remote_id, get_size, get_socks, get_software_ext,
|
||||
get_software_store_path, get_software_update_url, get_uuid, get_version, goto_install,
|
||||
has_hwcodec, has_rendezvous_service, install_me, install_path, is_can_screen_recording,
|
||||
is_installed, is_installed_daemon, is_installed_lower_version, is_login_wayland,
|
||||
is_ok_change_id, is_process_trusted, is_rdp_service_open, is_share_rdp, is_xfce,
|
||||
modify_default_login, new_remote, open_url, peer_has_password, permanent_password,
|
||||
post_request, recent_sessions_updated, remove_peer, run_without_install, set_local_option,
|
||||
set_option, set_options, set_peer_option, set_permanent_password, set_remote_id, set_share_rdp,
|
||||
set_socks, show_run_without_install, store_fav, t, temporary_password, test_if_valid_server,
|
||||
update_me, update_temporary_password, using_public_server,
|
||||
};
|
||||
use crate::ui_interface::*;
|
||||
|
||||
mod cm;
|
||||
#[cfg(feature = "inline")]
|
||||
@ -349,6 +334,14 @@ impl UI {
|
||||
is_installed()
|
||||
}
|
||||
|
||||
fn is_root(&self) -> bool {
|
||||
is_root()
|
||||
}
|
||||
|
||||
fn is_release(&self) -> bool {
|
||||
is_release()
|
||||
}
|
||||
|
||||
fn is_rdp_service_open(&self) -> bool {
|
||||
is_rdp_service_open()
|
||||
}
|
||||
@ -615,6 +608,8 @@ impl sciter::EventHandler for UI {
|
||||
fn get_icon();
|
||||
fn install_me(String, String);
|
||||
fn is_installed();
|
||||
fn is_root();
|
||||
fn is_release();
|
||||
fn set_socks(String, String, String);
|
||||
fn get_socks();
|
||||
fn is_rdp_service_open();
|
||||
|
@ -1242,3 +1242,9 @@ function refreshCurrentUser() {
|
||||
function getHttpHeaders() {
|
||||
return "Authorization: Bearer " + handler.get_local_option("access_token");
|
||||
}
|
||||
|
||||
$(body).timer(1000, function check_elevation(){
|
||||
if (is_win && handler.is_release() && !handler.is_installed() && !handler.is_root()) {
|
||||
msgbox("custom-elevation-nocancel", "Prompt", "elevation_prompt");
|
||||
}
|
||||
});
|
@ -755,6 +755,19 @@ pub fn has_hwcodec() -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_release() -> bool {
|
||||
#[cfg(not(debug_assertions))]
|
||||
return true;
|
||||
#[cfg(debug_assertions)]
|
||||
return false;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_root() -> bool {
|
||||
crate::platform::is_root()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn check_super_user_permission() -> bool {
|
||||
#[cfg(any(windows, target_os = "linux"))]
|
||||
|
Loading…
x
Reference in New Issue
Block a user