add windows uni to registry when install

This commit is contained in:
rustdesk 2023-06-05 00:27:40 +08:00
parent e3d2dcf0c8
commit b84cf2f804

View File

@ -962,6 +962,9 @@ pub fn update_me() -> ResultType<()> {
fn get_after_install(exe: &str) -> String {
let app_name = crate::get_app_name();
let ext = app_name.to_lowercase();
// reg delete HKEY_CURRENT_USER\Software\Classes for
// https://github.com/rustdesk/rustdesk/commit/f4bdfb6936ae4804fc8ab1cf560db192622ad01a
// and https://github.com/leanflutter/uni_links_desktop/blob/1b72b0226cec9943ca8a84e244c149773f384e46/lib/src/protocol_registrar_impl_windows.dart#L30
format!("
chcp 65001
reg add HKEY_CLASSES_ROOT\\.{ext} /f
@ -971,6 +974,13 @@ fn get_after_install(exe: &str) -> String {
reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open /f
reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open\\command /f
reg add HKEY_CLASSES_ROOT\\.{ext}\\shell\\open\\command /f /ve /t REG_SZ /d \"\\\"{exe}\\\" --play \\\"%%1\\\"\"
reg delete HKEY_CURRENT_USER\Software\Classes\\{exe} /f
reg add HKEY_CLASSES_ROOT\\{ext} /f
reg add HKEY_CLASSES_ROOT\\{ext} /f /v \"URL Protocol\" /t REG_SZ /d \"\"
reg add HKEY_CLASSES_ROOT\\{ext}\\shell /f
reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open /f
reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open\\command /f
reg add HKEY_CLASSES_ROOT\\{ext}\\shell\\open\\command /f /ve /t REG_SZ /d \"\\\"{exe}\\\" \\\"%%1\\\"\"
sc create {app_name} binpath= \"\\\"{exe}\\\" --service\" start= auto DisplayName= \"{app_name} Service\"
netsh advfirewall firewall add rule name=\"{app_name} Service\" dir=in action=allow program=\"{exe}\" enable=yes
sc start {app_name}