refactor: backend (#7102)

* refactor(tray): move tray log opening to utils helper

* refactor(enhance): move owned config through pipeline

* refactor(enhance): move sequence values in use_seq

* refactor(enhance): move values while sorting fields

* refactor(enhance): move values when lowercasing owned config

* refactor(backend): move owned config values in utilities

* refactor(tray): borrow hotkey accelerators

* refactor(core): borrow proxy config strings

* fix(backend): preserve config patch semantics

* refactor(enhance): clarify config transform names
This commit is contained in:
Tunglies
2026-05-26 10:47:03 +00:00
committed by GitHub
parent a287d13b4d
commit 761209bbbc
11 changed files with 198 additions and 157 deletions
+13 -14
View File
@@ -37,23 +37,22 @@ impl IRuntime {
}
}
let patch_tun = patch.get("tun");
if let Some(patch_tun_value) = patch_tun {
let mut tun = config
.get("tun")
.and_then(|val| val.as_mapping())
.cloned()
.unwrap_or_else(Mapping::new);
let Some(patch_tun) = patch.get("tun") else {
return;
};
if let Some(patch_tun_mapping) = patch_tun_value.as_mapping() {
for key in use_keys(patch_tun_mapping) {
if let Some(value) = patch_tun_mapping.get(key.as_str()) {
tun.insert(Value::from(key.as_str()), value.clone());
}
let tun_key = Value::from("tun");
if !matches!(config.get(&tun_key), Some(Value::Mapping(_))) {
config.insert(tun_key.clone(), Value::Mapping(Mapping::new()));
}
if let (Some(patch_tun_mapping), Some(Value::Mapping(tun))) = (patch_tun.as_mapping(), config.get_mut(&tun_key))
{
for key in use_keys(patch_tun_mapping) {
if let Some(value) = patch_tun_mapping.get(key.as_str()) {
tun.insert(Value::from(key.as_str()), value.clone());
}
}
config.insert("tun".into(), Value::from(tun));
}
}