chore: merge dev into connection rule editor

This commit is contained in:
Tunglies
2026-11-15 01:53:34 +08:00
4 changed files with 24 additions and 7 deletions
+1
View File
@@ -32,6 +32,7 @@
- 修复窗口较窄时,首页「当前节点」卡片中过长的节点名把延迟标签挤出卡片
- 修复断开链式代理时清空已选节点,导致再次连接需要重新选择的问题
- 修复「连接」页表格排序时表头换行、标题位置跳动的问题
- 修复「TUN 设置」未手动保存时,界面显示的默认 MTU 1500 未生效的问题
- 修复连接详情较窄时操作按钮偏离右侧
**🍎 macOS**
+2
View File
@@ -70,6 +70,8 @@ pub mod files {
pub mod tun {
pub const DEFAULT_STACK: &str = "mips";
pub const DEFAULT_MTU: u16 = 1500;
pub const DNS_HIJACK: &[&str] = &["any:53"];
/// Saved dialog fields; `enable` belongs to the verge switch.
+15 -2
View File
@@ -459,7 +459,7 @@ fn gui_tun_keys(clash_config: &Mapping) -> Vec<Value> {
keys.extend(
constants::tun::GUI_KEYS
.iter()
.filter(|key| tun.contains_key(**key))
.filter(|key| tun.get(**key).is_some_and(|value| !value.is_null()))
.map(|key| Value::from(*key)),
);
}
@@ -531,6 +531,16 @@ fn ensure_lan_bind_address(mut config: Mapping) -> Mapping {
config
}
fn ensure_tun_default_mtu(mut config: Mapping) -> Mapping {
if let Some(Value::Mapping(tun)) = config.get_mut("tun")
&& matches!(tun.get("mtu"), None | Some(Value::Null))
{
tun.insert(Value::from("mtu"), Value::from(constants::tun::DEFAULT_MTU));
}
config
}
/// Merges the app's clash config over the profile; switches are parameters to keep it pure.
fn merge_default_config(
mut config: Mapping,
@@ -548,7 +558,9 @@ fn merge_default_config(
});
let patch_tun = value.as_mapping().cloned().unwrap_or_else(Mapping::new);
for (key, value) in patch_tun.into_iter() {
tun.insert(key, value);
if !value.is_null() {
tun.insert(key, value);
}
}
config.insert("tun".into(), tun.into());
} else {
@@ -878,6 +890,7 @@ pub async fn enhance(
notify_discarded_keys(authoritative.overridden(&authoritative, &authoritative.current(&config)));
let config = authoritative.enforce(config);
let config = ensure_tun_default_mtu(config);
let config = ensure_lan_bind_address(config);
let config = cleanup_proxy_groups(config);
+6 -5
View File
@@ -54,7 +54,7 @@ export function TunViewer({ ref }: { ref?: Ref<DialogRef> }) {
autoDetectInterface: true,
dnsHijack: ['any:53'],
strictRoute: false,
mtu: 1500,
mtu: 1500 as number | undefined,
dnsMode: '',
})
@@ -374,14 +374,15 @@ export function TunViewer({ ref }: { ref?: Ref<DialogRef> }) {
autoCapitalize="off"
spellCheck="false"
sx={{ width: 250 }}
value={values.mtu}
value={values.mtu ?? ''}
placeholder="1500"
onChange={(e) =>
onChange={(e) => {
const next = Number.parseInt(e.target.value, 10)
setValues((v) => ({
...v,
mtu: parseInt(e.target.value),
mtu: Number.isNaN(next) ? undefined : next,
}))
}
}}
/>
</ListItem>