windows silent install notification

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-09-07 21:29:49 +08:00
parent 065c19cbbc
commit 91decea302
38 changed files with 698 additions and 549 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

@ -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)]

File diff suppressed because it is too large Load Diff

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

@ -408,7 +408,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time password length", "Tek seferlik şifre uzunluğu"),
("Request access to your device", "Cihazınıza erişim talep edin"),
("Hide connection management window", "Bağlantı yönetimi penceresini gizle"),
("hide_cm_tip", "Oturumları yalnızca parola ile kabul edebilir ve kalıcı parola kullanıyorsanız gizlemeye izin verin"),
("hide_cm_tip", "Oturumları yalnızca parola ile kabul edebilir ve kalıcı parola kullanıyorsanız gizlemeye izin verin"),
("wayland_experiment_tip", "Wayland desteği deneysel aşamada olduğundan, gerektiğinde X11'i kullanmanız önerilir"),
("Right click to select tabs", "Sekmeleri seçmek için sağ tıklayın"),
("Skipped", "Atlandı"),
@ -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();
}