Revert "feat: update Cargo.toml for 2024 edition and optimize release profiles (#4681)"

This reverts commit 31e3104c7f.
This commit is contained in:
Tunglies
2025-09-08 21:48:09 +08:00
parent 31e3104c7f
commit 55b95a1985
51 changed files with 793 additions and 782 deletions

View File

@@ -1,6 +1,6 @@
use crate::{
config::Config,
core::{CoreManager, handle, tray},
core::{handle, tray, CoreManager},
ipc::IpcManager,
logging_error,
process::AsyncHandler,

View File

@@ -1,6 +1,6 @@
use crate::{
config::{Config, IVerge},
core::{CoreManager, handle, hotkey, sysopt, tray},
core::{handle, hotkey, sysopt, tray, CoreManager},
logging_error,
module::lightweight,
utils::logging::Type,
@@ -202,10 +202,10 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
if (update_flags & (UpdateFlags::SysProxy as i32)) != 0 {
sysopt::Sysopt::global().update_sysproxy().await?;
}
if (update_flags & (UpdateFlags::Hotkey as i32)) != 0
&& let Some(hotkeys) = patch.hotkeys
{
hotkey::Hotkey::global().update(hotkeys).await?;
if (update_flags & (UpdateFlags::Hotkey as i32)) != 0 {
if let Some(hotkeys) = patch.hotkeys {
hotkey::Hotkey::global().update(hotkeys).await?;
}
}
if (update_flags & (UpdateFlags::SystrayMenu as i32)) != 0 {
tray::Tray::global().update_menu().await?;

View File

@@ -1,11 +1,11 @@
use crate::{
cmd,
config::{Config, PrfItem, PrfOption, profiles::profiles_draft_update_item_safe},
core::{CoreManager, handle, tray},
config::{profiles::profiles_draft_update_item_safe, Config, PrfItem, PrfOption},
core::{handle, tray, CoreManager},
logging,
utils::logging::Type,
};
use anyhow::{Result, bail};
use anyhow::{bail, Result};
/// Toggle proxy profile
pub async fn toggle_proxy_profile(profile_index: String) {

View File

@@ -13,22 +13,21 @@ pub async fn toggle_system_proxy() {
// 获取当前系统代理状态
let enable = {
let verge = Config::verge().await;
verge.latest_ref().enable_system_proxy.unwrap_or(false)
let enable = verge.latest_ref().enable_system_proxy.unwrap_or(false);
enable
};
// 获取自动关闭连接设置
let auto_close_connection = {
let verge = Config::verge().await;
verge.latest_ref().auto_close_connection.unwrap_or(false)
let auto_close = verge.latest_ref().auto_close_connection.unwrap_or(false);
auto_close
};
// 如果当前系统代理即将关闭且自动关闭连接设置为true则关闭所有连接
if enable
&& auto_close_connection
&& let Err(err) = IpcManager::global().close_all_connections().await
{
log::error!(target: "app", "Failed to close all connections: {err}");
if enable && auto_close_connection {
if let Err(err) = IpcManager::global().close_all_connections().await {
log::error!(target: "app", "Failed to close all connections: {err}");
}
}
let patch_result = super::patch_verge(

View File

@@ -1,6 +1,6 @@
use crate::{
config::Config,
core::{CoreManager, handle, sysopt},
core::{handle, sysopt, CoreManager},
ipc::IpcManager,
logging,
utils::logging::Type,
@@ -92,7 +92,7 @@ pub async fn quit() {
}
async fn clean_async() -> bool {
use tokio::time::{Duration, timeout};
use tokio::time::{timeout, Duration};
logging!(info, Type::System, true, "开始执行异步清理操作...");
@@ -252,10 +252,10 @@ pub async fn hide() {
add_light_weight_timer().await;
}
if let Some(window) = handle::Handle::global().get_window()
&& window.is_visible().unwrap_or(false)
{
let _ = window.hide();
if let Some(window) = handle::Handle::global().get_window() {
if window.is_visible().unwrap_or(false) {
let _ = window.hide();
}
}
handle::Handle::global().set_activation_policy_accessory();
}