chore: adjust code
This commit is contained in:
parent
8464e319fd
commit
5225c841ae
@ -28,6 +28,10 @@ pub use self::profiles::*;
|
|||||||
pub use self::service::*;
|
pub use self::service::*;
|
||||||
pub use self::verge::*;
|
pub use self::verge::*;
|
||||||
|
|
||||||
|
/// close the window for slient start
|
||||||
|
/// after enhance mode
|
||||||
|
static mut WINDOW_CLOSABLE: bool = true;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Core {
|
pub struct Core {
|
||||||
pub clash: Arc<Mutex<Clash>>,
|
pub clash: Arc<Mutex<Clash>>,
|
||||||
@ -48,10 +52,9 @@ pub struct Core {
|
|||||||
impl Core {
|
impl Core {
|
||||||
pub fn new() -> Core {
|
pub fn new() -> Core {
|
||||||
let clash = Clash::new();
|
let clash = Clash::new();
|
||||||
let mut verge = Verge::new();
|
let verge = Verge::new();
|
||||||
let profiles = Profiles::new();
|
let profiles = Profiles::new();
|
||||||
let service = Service::new();
|
let service = Service::new();
|
||||||
verge.launch_flag = Some(true);
|
|
||||||
|
|
||||||
Core {
|
Core {
|
||||||
clash: Arc::new(Mutex::new(clash)),
|
clash: Arc::new(Mutex::new(clash)),
|
||||||
@ -383,11 +386,17 @@ impl Core {
|
|||||||
result.error.map(|err| log::error!("{err}"));
|
result.error.map(|err| log::error!("{err}"));
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut verge = self.verge.lock();
|
let verge = self.verge.lock();
|
||||||
let silent_start = verge.enable_silent_start.clone();
|
let silent_start = verge.enable_silent_start.clone();
|
||||||
if silent_start.unwrap_or(false) && verge.launch_flag.unwrap_or(false) {
|
|
||||||
|
let closable = unsafe { WINDOW_CLOSABLE };
|
||||||
|
|
||||||
|
if silent_start.unwrap_or(false) && closable {
|
||||||
|
unsafe {
|
||||||
|
WINDOW_CLOSABLE = false;
|
||||||
|
}
|
||||||
|
|
||||||
window.emit("script-handler-close", payload).unwrap();
|
window.emit("script-handler-close", payload).unwrap();
|
||||||
verge.launch_flag = Some(false);
|
|
||||||
} else {
|
} else {
|
||||||
window.emit("script-handler", payload).unwrap();
|
window.emit("script-handler", payload).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
use anyhow::{Context, Result};
|
|
||||||
use std::env::current_exe;
|
|
||||||
|
|
||||||
pub struct CoreItem {
|
|
||||||
pub name: String,
|
|
||||||
pub path: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Multi {}
|
|
||||||
|
|
||||||
impl Multi {
|
|
||||||
pub fn list() -> Result<Vec<CoreItem>> {
|
|
||||||
let paths = current_exe()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.read_dir()
|
|
||||||
.context("failed to current dir")?;
|
|
||||||
|
|
||||||
for path in paths {
|
|
||||||
dbg!(path.unwrap().path().metadata().unwrap().permissions().);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(vec![])
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,10 +37,6 @@ pub struct Verge {
|
|||||||
/// enable proxy guard
|
/// enable proxy guard
|
||||||
pub enable_proxy_guard: Option<bool>,
|
pub enable_proxy_guard: Option<bool>,
|
||||||
|
|
||||||
/// launch flag
|
|
||||||
#[serde(skip_serializing)]
|
|
||||||
pub launch_flag: Option<bool>,
|
|
||||||
|
|
||||||
/// set system proxy bypass
|
/// set system proxy bypass
|
||||||
pub system_proxy_bypass: Option<String>,
|
pub system_proxy_bypass: Option<String>,
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ class Enhance {
|
|||||||
|
|
||||||
emit(payload.callback, JSON.stringify(result)).catch(console.error);
|
emit(payload.callback, JSON.stringify(result)).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the handler
|
// setup the handler
|
||||||
setup() {
|
setup() {
|
||||||
if (this.isSetup) return;
|
if (this.isSetup) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user