Merge pull request #5632 from 21pages/silent-install

windows silent install notification
This commit is contained in:
RustDesk 2023-09-08 10:49:54 +08:00 committed by GitHub
commit b3b9555daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 701 additions and 574 deletions

65
Cargo.lock generated
View File

@ -4422,7 +4422,7 @@ dependencies = [
"base64",
"indexmap",
"line-wrap",
"quick-xml",
"quick-xml 0.28.2",
"serde 1.0.163",
"time 0.3.21",
]
@ -4622,6 +4622,15 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "quick-xml"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea"
dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.28.2"
@ -5199,6 +5208,7 @@ dependencies = [
"sys-locale",
"system_shutdown",
"tao",
"tauri-winrt-notification",
"tray-icon",
"url",
"users 0.11.0",
@ -5971,6 +5981,16 @@ dependencies = [
"serde_json 0.9.10",
]
[[package]]
name = "tauri-winrt-notification"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f5bff1d532fead7c43324a0fa33643b8621a47ce2944a633be4cb6c0240898f"
dependencies = [
"quick-xml 0.23.1",
"windows 0.39.0",
]
[[package]]
name = "tempfile"
version = "3.5.0"
@ -6824,6 +6844,19 @@ dependencies = [
"windows_x86_64_msvc 0.34.0",
]
[[package]]
name = "windows"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a"
dependencies = [
"windows_aarch64_msvc 0.39.0",
"windows_i686_gnu 0.39.0",
"windows_i686_msvc 0.39.0",
"windows_x86_64_gnu 0.39.0",
"windows_x86_64_msvc 0.39.0",
]
[[package]]
name = "windows"
version = "0.44.0"
@ -6973,6 +7006,12 @@ version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d"
[[package]]
name = "windows_aarch64_msvc"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
@ -6997,6 +7036,12 @@ version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed"
[[package]]
name = "windows_i686_gnu"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
@ -7021,6 +7066,12 @@ version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956"
[[package]]
name = "windows_i686_msvc"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
@ -7045,6 +7096,12 @@ version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4"
[[package]]
name = "windows_x86_64_gnu"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
@ -7081,6 +7138,12 @@ version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9"
[[package]]
name = "windows_x86_64_msvc"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"

View File

@ -97,6 +97,7 @@ virtual_display = { path = "libs/virtual_display", optional = true }
impersonate_system = { git = "https://github.com/21pages/impersonate-system" }
shared_memory = "0.12"
shutdown_hooks = "0.1"
tauri-winrt-notification = "0.1.2"
[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2"

View File

@ -278,16 +278,6 @@ class ChatModel with ChangeNotifier {
}
}
showSidePage() async {
if (isDesktop) {
if (isConnManager) {
if (!_isShowCMSidePage) {
await toggleCMSidePage();
}
}
}
}
toggleCMChatPage(MessageKey key) async {
if (gFFI.chatModel.currentKey != key) {
gFFI.chatModel.changeCurrentKey(key);

View File

@ -14,8 +14,6 @@ class CmFileModel {
final _jobTables = HashMap<int, RxList<JobProgress>>.fromEntries([]);
Stopwatch stopwatch = Stopwatch();
int _lastElapsed = 0;
bool _jobAdded = false;
bool _showing = false;
CmFileModel(this.parent);
@ -44,16 +42,6 @@ class CmFileModel {
_dealOneJob(d, calcSpeed);
}
currentJobTable.refresh();
Future.delayed(Duration.zero, () async {
if (_jobAdded) {
_jobAdded = false;
if (!_showing) {
_showing = true;
await gFFI.chatModel.showSidePage();
_showing = false;
}
}
});
} catch (e) {
debugPrint("onFileTransferLog:$e");
}
@ -72,10 +60,10 @@ class CmFileModel {
if (job == null) {
job = JobProgress();
jobTable.add(job);
_jobAdded = true;
final currentSelectedTab =
gFFI.serverModel.tabController.state.value.selectedTabInfo;
if (currentSelectedTab.key != data.connId.toString()) {
if (!(gFFI.chatModel.isShowCMSidePage &&
currentSelectedTab.key == data.connId.toString())) {
client?.unreadChatMessageCount.value += 1;
}
}

View File

@ -1,3 +1,5 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::client::translate;
#[cfg(not(debug_assertions))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::platform::breakdown_callback;
@ -5,6 +7,8 @@ use hbb_common::log;
#[cfg(not(debug_assertions))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::platform::register_breakdown_handler;
#[cfg(windows)]
use tauri_winrt_notification::{Duration, Sound, Toast};
#[macro_export]
macro_rules! my_println{
@ -178,12 +182,23 @@ pub fn core_main() -> Option<Vec<String>> {
}
return None;
} else if args[0] == "--silent-install" {
hbb_common::allow_err!(platform::install_me(
let res = platform::install_me(
"desktopicon startmenu driverCert",
"".to_owned(),
true,
args.len() > 1,
));
);
let text = match res {
Ok(_) => translate("Installation Successful!".to_string()),
Err(_) => translate("Installation failed!".to_string()),
};
Toast::new(Toast::POWERSHELL_APP_ID)
.title(&hbb_common::config::APP_NAME.read().unwrap())
.text1(&text)
.sound(Some(Sound::Default))
.duration(Duration::Short)
.show()
.ok();
return None;
} else if args[0] == "--install-cert" {
#[cfg(windows)]

View File

@ -1,5 +1,5 @@
lazy_static::lazy_static! {
pub static ref T: std::collections::HashMap<&'static str, &'static str> =
pub static ref T: std::collections::HashMap<&'static str, &'static str> =
[
("Status", "الحالة"),
("Your Desktop", "سطح مكتبك"),
@ -482,8 +482,6 @@ lazy_static::lazy_static! {
("View Mode", "وضع العرض"),
("login_linux_tip", "تحتاج الى تسجيل الدخول حساب لينكس البعيد وتفعيل جلسة سطح مكتب X"),
("verify_rustdesk_password_tip", "تحقق من كلمة مرور RustDesk"),
("enter_rustdesk_passwd_tip", "ادخل كلمة مرور RustDesk"),
("remember_rustdesk_passwd_tip", "تذكر كلمة مرور RustDesk"),
("remember_account_tip", "تذكر هذا الحساب"),
("os_account_desk_tip", "هذا الحساب مستخدم لتسجيل الدخول الى سطح المكتب البعيد وتفعيل الجلسة"),
("OS Account", "حساب نظام التشغيل"),
@ -540,6 +538,10 @@ lazy_static::lazy_static! {
("pull_ab_failed_tip", "فشل تحديث كتاب العناوين"),
("push_ab_failed_tip", "فشل مزامنة كتاب العناوين مع الخادم"),
("synced_peer_readded_tip", "الاجهزة الموجودة في الجلسات الحديثة سيتم مزامنتها مع كتاب العناوين"),
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "更改颜色"),
("Primary Color", "基本色"),
("HSV Color", "HSV 色"),
("Installation Successful!", "安装成功!"),
("Installation failed!", "安装失败!"),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Farbe ändern"),
("Primary Color", "Primärfarbe"),
("HSV Color", "HSV-Farbe"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Cambiar Color"),
("Primary Color", "Color Primario"),
("HSV Color", "Color HSV"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Modifier la couleur"),
("Primary Color", "Couleur primaire"),
("HSV Color", "Couleur TSL"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Ganti warna"),
("Primary Color", "Warna utama"),
("HSV Color", "Warna HSV"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Modifica colore"),
("Primary Color", "Colore primario"),
("HSV Color", "Colore HSV"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Kleur Aanpassen"),
("Primary Color", "Hoofdkleur"),
("HSV Color", "HSV Kleur"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Изменить цвет"),
("Primary Color", "Основной цвет"),
("HSV Color", "HSV цвет"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "Rengi Değiştir"),
("Primary Color", "Birincil Renk"),
("HSV Color", "HSV Rengi"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", "更改顏色"),
("Primary Color", "基本色"),
("HSV Color", "HSV 色"),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}

View File

@ -541,5 +541,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Change Color", ""),
("Primary Color", ""),
("HSV Color", ""),
("Installation Successful!", ""),
("Installation failed!", ""),
].iter().cloned().collect();
}