diff --git a/TODO.md b/TODO.md index 551993d..8e05615 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,2 @@ - 添加开机自启动教程 -- 完善许可证的使用 -- 将未使用的组件和图标移除出去 \ No newline at end of file +- 完善许可证的使用 \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 11c433d..244c77b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -296,17 +296,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "auto-launch" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471" -dependencies = [ - "dirs", - "thiserror", - "winreg 0.10.1", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -961,15 +950,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -980,17 +960,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -4283,21 +4252,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "tauri-plugin-autostart" -version = "2.0.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a11d976fdee482eddf3bc846284fe46c2fea94b202fc6bf846e5db411346b11d" -dependencies = [ - "auto-launch", - "log", - "serde", - "serde_json", - "tauri", - "tauri-plugin", - "thiserror", -] - [[package]] name = "tauri-plugin-process" version = "2.0.0-beta.2" @@ -4768,7 +4722,6 @@ dependencies = [ "serde_json", "tauri", "tauri-build", - "tauri-plugin-autostart", "tauri-plugin-process", "tauri-plugin-single-instance", "tokio", @@ -5574,15 +5527,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - [[package]] name = "winreg" version = "0.50.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 608b01d..67b3de8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -15,7 +15,6 @@ tauri-build = { version = "2.0.0-beta", features = [] } tauri = { version = "2.0.0-beta", features = ["tray-icon"] } tauri-plugin-process = "2.0.0-beta" tauri-plugin-single-instance = "2.0.0-beta" -tauri-plugin-autostart = "2.0.0-beta" # For base once_cell = "1" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9ccd11d..188819e 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -55,10 +55,6 @@ async fn main() { tauri::Builder::default() .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_single_instance::init(|_, _, _| {})) - .plugin(tauri_plugin_autostart::init( - tauri_plugin_autostart::MacosLauncher::LaunchAgent, - Some(vec![]), - )) .setup(setup::handler) .invoke_handler(tauri::generate_handler![copy, open, translate, pin,]) .run(tauri::generate_context!()) diff --git a/src-tauri/src/tray.rs b/src-tauri/src/tray.rs index 408517c..e16ffcd 100644 --- a/src-tauri/src/tray.rs +++ b/src-tauri/src/tray.rs @@ -6,7 +6,6 @@ use tauri::{ tray::TrayIconBuilder, AppHandle, Manager, Wry, }; -use tauri_plugin_autostart::AutoLaunchManager; use crate::config::{self, MODE}; @@ -26,19 +25,6 @@ pub fn init(app: &AppHandle) -> Result<()> { fn menu(handle: &AppHandle) -> Result> { let flag = MODE.load(Ordering::SeqCst); - - let manager = handle.state::(); - let autostart_flag = manager.is_enabled().unwrap_or_default(); - - let autostart = CheckMenuItem::with_id( - handle, - "autostart", - "AutoStart", - true, - autostart_flag, - None::<&str>, - ) - .expect("Failed to create menu item autostart"); let mirror = CheckMenuItem::with_id(handle, "mirror", "Mirror", true, flag, None::<&str>) .expect("Failed to create menu item mirror"); let google = CheckMenuItem::with_id(handle, "google", "Google", true, !flag, None::<&str>) @@ -55,7 +41,7 @@ fn menu(handle: &AppHandle) -> Result> { .expect("Failed to create submenu item mod."); let exit = MenuItem::with_id(handle, "exit", "Exit", true, None::<&str>) .expect("Failed to create menu item exit"); - Menu::with_items(handle, &[&autostart, &mode, &about, &exit]) + Menu::with_items(handle, &[&mode, &about, &exit]) .map_err(|_| anyhow::anyhow!("Failed to create menu")) } @@ -65,15 +51,6 @@ fn fresh(app: &AppHandle) { fn handler(app: &AppHandle, event: MenuEvent) { match event.id.as_ref() { - "autostart" => { - let manager = app.state::(); - let autostart_flag = manager.is_enabled().unwrap_or_default(); - if autostart_flag { - let _ = manager.disable(); - } else { - let _ = manager.enable(); - } - } "mirror" => { config::mode(true); }