Refactor configuration access to use latest_arc() instead of latest_ref()

- Updated multiple instances in the codebase to replace calls to latest_ref() with latest_arc() for improved performance and memory management.
- This change affects various modules including validate, enhance, feat (backup, clash, config, profile, proxy, window), utils (draft, i18n, init, network, resolve, server).
- Ensured that all references to configuration data are now using the new arc-based approach to enhance concurrency and reduce cloning overhead.

refactor: update imports to explicitly include ClashInfo and Config in command files
This commit is contained in:
Tunglies
2025-11-03 05:41:53 +08:00
Unverified
parent 48a19f99e2
commit 2287ea5f0b
37 changed files with 533 additions and 331 deletions

View File

@@ -89,15 +89,15 @@ pub fn embed_server() {
let clash_config = Config::clash().await;
let pac_content = verge_config
.latest_ref()
.latest_arc()
.pac_file_content
.clone()
.unwrap_or_else(|| DEFAULT_PAC.into());
let pac_port = verge_config
.latest_ref()
.latest_arc()
.verge_mixed_port
.unwrap_or_else(|| clash_config.latest_ref().get_mixed_port());
.unwrap_or_else(|| clash_config.latest_arc().get_mixed_port());
let pac = warp::path!("commands" / "pac").map(move || {
let processed_content = pac_content.replace("%mixed-port%", &format!("{pac_port}"));