Fix app not displayed when click on the dock icon under macOS (#424)
Some checks failed
EasyTier Core / pre_job (push) Has been cancelled
EasyTier GUI / pre_job (push) Has been cancelled
EasyTier Mobile / pre_job (push) Has been cancelled
EasyTier Test / pre_job (push) Has been cancelled
EasyTier Core / build (freebsd-13.2-x86_64, 13.2, ubuntu-latest, x86_64-unknown-freebsd) (push) Has been cancelled
EasyTier Core / build (linux-aarch64, ubuntu-latest, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-arm, ubuntu-latest, arm-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armhf, ubuntu-latest, arm-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-armv7, ubuntu-latest, armv7-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armv7hf, ubuntu-latest, armv7-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-mips, ubuntu-latest, mips-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-mipsel, ubuntu-latest, mipsel-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-x86_64, ubuntu-latest, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (macos-aarch64, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (macos-x86_64, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (windows-x86_64, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / core-result (push) Has been cancelled
EasyTier GUI / build-gui (linux-aarch64, aarch64-unknown-linux-gnu, ubuntu-latest, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (linux-x86_64, x86_64-unknown-linux-gnu, ubuntu-latest, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (macos-aarch64, aarch64-apple-darwin, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (macos-x86_64, x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (windows-x86_64, x86_64-pc-windows-msvc, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / gui-result (push) Has been cancelled
EasyTier Mobile / build-mobile (android, ubuntu-latest, android) (push) Has been cancelled
EasyTier Mobile / mobile-result (push) Has been cancelled
EasyTier Test / test (push) Has been cancelled

This commit is contained in:
fanyang 2024-10-14 21:33:48 +08:00 committed by GitHub
parent 949003ee1b
commit 70708b34cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 21 deletions

View File

@ -16,6 +16,7 @@ use easytier::{
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::Manager as _; use tauri::Manager as _;
use tauri::RunEvent;
pub const AUTOSTART_ARG: &str = "--autostart"; pub const AUTOSTART_ARG: &str = "--autostart";
@ -335,7 +336,7 @@ pub fn run() {
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_vpnservice::init()); .plugin(tauri_plugin_vpnservice::init());
builder let mut app = builder
.setup(|app| { .setup(|app| {
// for logging config // for logging config
let Ok(log_dir) = app.path().app_log_dir() else { let Ok(log_dir) = app.path().app_log_dir() else {
@ -394,6 +395,17 @@ pub fn run() {
} }
_ => {} _ => {}
}) })
.run(tauri::generate_context!()) .build(tauri::generate_context!())
.expect("error while running tauri application"); .unwrap();
#[cfg(not(target_os = "macos"))]
app.run(|_app, _event| {});
#[cfg(target_os = "macos")]
app.run(|app, event| match event {
RunEvent::Reopen { .. } => {
toggle_window_visibility(app);
}
_ => {}
});
} }

View File

@ -57,7 +57,9 @@ impl HostResolverIter {
.filter(|x| x.is_ipv4()) .filter(|x| x.is_ipv4())
.choose_multiple(&mut rand::thread_rng(), self.max_ip_per_domain as usize); .choose_multiple(&mut rand::thread_rng(), self.max_ip_per_domain as usize);
if self.ips.is_empty() {return self.next().await;} if self.ips.is_empty() {
return self.next().await;
}
} }
Err(e) => { Err(e) => {
tracing::warn!(?host, ?e, "lookup host for stun failed"); tracing::warn!(?host, ?e, "lookup host for stun failed");

View File

@ -69,10 +69,14 @@ impl<'d> TxToken for BufferTxToken<'d> {
} }
impl Device for BufferDevice { impl Device for BufferDevice {
type RxToken<'a> = BufferRxToken type RxToken<'a>
where Self:'a; = BufferRxToken
type TxToken<'a> = BufferTxToken<'a> where
where Self:'a; Self: 'a;
type TxToken<'a>
= BufferTxToken<'a>
where
Self: 'a;
fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
match self.recv_queue.pop_front() { match self.recv_queue.pop_front() {

View File

@ -137,7 +137,6 @@ impl EasyTierLauncher {
let vpn_portal = instance.get_vpn_portal_inst(); let vpn_portal = instance.get_vpn_portal_inst();
tasks.spawn(async move { tasks.spawn(async move {
loop { loop {
// Update TUN Device Name // Update TUN Device Name
*data_c.tun_dev_name.write().unwrap() = global_ctx_c.get_flags().dev_name.clone(); *data_c.tun_dev_name.write().unwrap() = global_ctx_c.get_flags().dev_name.clone();

View File

@ -4,18 +4,18 @@ pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum Error { pub enum Error {
#[error(transparent)] #[error(transparent)]
Io(#[from] std::io::Error), Io(#[from] std::io::Error),
#[cfg(mobile)] #[cfg(mobile)]
#[error(transparent)] #[error(transparent)]
PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError),
} }
impl Serialize for Error { impl Serialize for Error {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {
serializer.serialize_str(self.to_string().as_ref()) serializer.serialize_str(self.to_string().as_ref())
} }
} }