瀏覽代碼

refactor: Hide Clash Field Option when Disable Filter (#63)

Pylogmon 1 年之前
父節點
當前提交
7534f8fc37
共有 2 個文件被更改,包括 19 次插入13 次删除
  1. 2 2
      src-tauri/src/config/verge.rs
  2. 17 11
      src/components/setting/setting-clash.tsx

+ 2 - 2
src-tauri/src/config/verge.rs

@@ -77,7 +77,7 @@ pub struct IVerge {
     /// 默认的延迟测试连接
     pub default_latency_test: Option<String>,
 
-    /// 支持关闭字段过滤,避免meta的新字段都被过滤掉,默认为
+    /// 支持关闭字段过滤,避免meta的新字段都被过滤掉,默认为关闭
     pub enable_clash_fields: Option<bool>,
 
     /// 是否使用内部的脚本支持,默认为真
@@ -151,7 +151,7 @@ impl IVerge {
             proxy_guard_duration: Some(30),
             auto_close_connection: Some(true),
             enable_builtin_enhanced: Some(true),
-            enable_clash_fields: Some(true),
+            enable_clash_fields: Some(false),
             auto_log_clean: Some(3),
             ..Self::default()
         }

+ 17 - 11
src/components/setting/setting-clash.tsx

@@ -38,7 +38,11 @@ const SettingClash = ({ onError }: Props) => {
 
   const { ipv6, "allow-lan": allowLan, "log-level": logLevel } = clash ?? {};
 
-  const { enable_random_port = false, verge_mixed_port } = verge ?? {};
+  const {
+    enable_random_port = false,
+    verge_mixed_port,
+    enable_clash_fields = false,
+  } = verge ?? {};
 
   const webRef = useRef<DialogRef>(null);
   const fieldRef = useRef<DialogRef>(null);
@@ -162,16 +166,18 @@ const SettingClash = ({ onError }: Props) => {
         </IconButton>
       </SettingItem>
 
-      <SettingItem label={t("Clash Field")}>
-        <IconButton
-          color="inherit"
-          size="small"
-          sx={{ my: "2px" }}
-          onClick={() => fieldRef.current?.open()}
-        >
-          <ArrowForward />
-        </IconButton>
-      </SettingItem>
+      {enable_clash_fields && (
+        <SettingItem label={t("Clash Field")}>
+          <IconButton
+            color="inherit"
+            size="small"
+            sx={{ my: "2px" }}
+            onClick={() => fieldRef.current?.open()}
+          >
+            <ArrowForward />
+          </IconButton>
+        </SettingItem>
+      )}
 
       <SettingItem
         label={t("Clash Core")}