mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
feat: change default singleton port and support to change the port
This commit is contained in:
@@ -17,15 +17,24 @@ use tauri::{
|
||||
};
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
if server::check_singleton().is_err() {
|
||||
let mut context = tauri::generate_context!();
|
||||
|
||||
let verge = Verge::new();
|
||||
|
||||
if server::check_singleton(verge.app_singleton_port).is_err() {
|
||||
println!("app exists");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
for win in context.config_mut().tauri.windows.iter_mut() {
|
||||
if verge.enable_silent_start.unwrap_or(false) {
|
||||
win.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
unsafe {
|
||||
use crate::utils::dirs;
|
||||
|
||||
dirs::init_portable_flag();
|
||||
}
|
||||
|
||||
@@ -167,13 +176,6 @@ fn main() -> std::io::Result<()> {
|
||||
builder = builder.menu(Menu::new().add_submenu(submenu_file));
|
||||
}
|
||||
|
||||
let mut context = tauri::generate_context!();
|
||||
let verge = Verge::new();
|
||||
for win in context.config_mut().tauri.windows.iter_mut() {
|
||||
if verge.enable_silent_start.unwrap_or(false) {
|
||||
win.visible = false;
|
||||
}
|
||||
}
|
||||
builder
|
||||
.build(context)
|
||||
.expect("error while running tauri application")
|
||||
|
||||
Reference in New Issue
Block a user