Merge pull request #370 from Heasn/master

Fix some macOS new services issues
This commit is contained in:
RustDesk 2022-01-14 23:22:08 +08:00 committed by GitHub
commit 6fe4344cb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 10 deletions

View File

@ -195,5 +195,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Socks5 Proxy", "Socks5 代理"),
("Hostname", "主机名"),
("Discovered", "已发现"),
("install_daemon","为了能够提供更好的\n远程桌面访问功能RustDesk\n需要\"安装系统服务\"")
].iter().cloned().collect();
}

View File

@ -154,7 +154,7 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
Err(e) => {
log::error!("run osascript failed: {}", e);
false
},
}
}
}

View File

@ -12,8 +12,8 @@ on run {daemon_file, root_agent_file, user_agent_file}
set sh6 to "launchctl load -w /Library/LaunchAgents/com.carriez.rustdesk.agent.user.plist;"
set sh to sh1 & sh2 & sh3 & sh4 & sh5 &sh6
set sh to sh1 & sh2 & sh3 & sh4 & sh5
log (sh)
do shell script sh with prompt "RustDesk 需要安装服务" with administrator privileges
do shell script sh with prompt "RustDesk want to install services" with administrator privileges
do shell script sh6
end run

View File

@ -2,6 +2,6 @@ set sh1 to "launchctl load -w /Library/LaunchAgents/com.carriez.rustdesk.agent.r
set sh2 to "launchctl load -w /Library/LaunchAgents/com.carriez.rustdesk.agent.user.plist;"
set sh to sh1 & sh2
do shell script sh1 with prompt "RustDesk want to launch services" with administrator privileges
do shell script sh with prompt "RustDesk 需要停止服务" with administrator privileges
do shell script sh2

View File

@ -2,6 +2,6 @@ set sh1 to "launchctl unload -w /Library/LaunchAgents/com.carriez.rustdesk.agent
set sh2 to "launchctl unload -w /Library/LaunchAgents/com.carriez.rustdesk.agent.user.plist;"
set sh to sh1 & sh2
do shell script sh1 with prompt "RustDesk want to stop services" with administrator privileges
do shell script sh with prompt "RustDesk 需要停止服务" with administrator privileges
do shell script sh2

View File

@ -23,6 +23,7 @@ use service::{GenericService, Service, ServiceTmpl, Subscriber};
use std::{
collections::HashMap,
net::SocketAddr,
path::PathBuf,
sync::{Arc, Mutex, RwLock, Weak},
time::Duration,
};
@ -276,7 +277,16 @@ pub async fn start_server(is_server: bool, _tray: bool) {
}
#[cfg(target_os = "macos")]
sync_and_watch_config_dir().await;
{
loop {
if crate::platform::macos::is_installed_daemon(false) {
break;
}
sleep(1.0).await;
}
sync_and_watch_config_dir().await;
}
if is_server {
std::thread::spawn(move || {

View File

@ -342,6 +342,7 @@ div.trust-me > div:nth-child(1) {
}
div.trust-me > div:nth-child(2) {
text-align: center;
font-size: 0.9em;
margin-bottom: 1em;
}

View File

@ -543,7 +543,7 @@ class ModifyDefaultLogin: Reactor.Component {
function watch_trust() {
// not use TrustMe::update, because it is buggy
var trusted = handler.is_process_trusted(false);
var trusted = handler.is_process_trusted(false) && handler.is_installed_daemon(false);
var el = $(div.trust-me);
if (el) {
el.style.set {