refactor: replace hardcoded DNS config filename with constant reference (#5280)

* refactor: replace hardcoded DNS config filename with constant reference

* refactor: remove redundant import of constants in IClashTemp template method

* refactor: add conditional compilation for DEFAULT_REDIR based on OS

* refactor: simplify default TPROXY port handling and remove unused trace_err macro

* refactor: simplify default TPROXY port fallback logic
This commit is contained in:
Tunglies
2025-11-01 22:50:19 +08:00
committed by GitHub
parent c0f9920531
commit 4a7859bdae
9 changed files with 22 additions and 59 deletions

View File

@@ -10,6 +10,7 @@ mod feat;
mod module;
mod process;
pub mod utils;
use crate::constants::files;
#[cfg(target_os = "macos")]
use crate::module::lightweight;
#[cfg(target_os = "linux")]
@@ -21,6 +22,7 @@ use crate::{
process::AsyncHandler,
utils::{resolve, server},
};
use anyhow::Result;
use config::Config;
use once_cell::sync::OnceCell;
use tauri::{AppHandle, Manager};
@@ -32,8 +34,6 @@ use utils::logging::Type;
pub static APP_HANDLE: OnceCell<AppHandle> = OnceCell::new();
/// Application initialization helper functions
mod app_init {
use anyhow::Result;
use super::*;
/// Initialize singleton monitoring for other instances
@@ -126,7 +126,7 @@ mod app_init {
pub fn setup_window_state(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {
logging!(info, Type::Setup, "初始化窗口状态管理...");
let window_state_plugin = tauri_plugin_window_state::Builder::new()
.with_filename("window_state.json")
.with_filename(files::WINDOW_STATE)
.with_state_flags(tauri_plugin_window_state::StateFlags::default())
.build();
app.handle().plugin(window_state_plugin)?;