MystiPanda 1 рік тому
батько
коміт
ce8383b26f

+ 1 - 1
src-tauri/src/config/clash.rs

@@ -32,7 +32,7 @@ impl IClashTemp {
     pub fn template() -> Self {
         let mut map = Mapping::new();
         let mut tun = Mapping::new();
-        tun.insert("stack".into(), "gVisor".into());
+        tun.insert("stack".into(), "gvisor".into());
         tun.insert("device".into(), "Meta".into());
         tun.insert("auto-route".into(), true.into());
         tun.insert("strict-route".into(), false.into());

+ 0 - 3
src-tauri/src/core/sysopt.rs

@@ -148,9 +148,6 @@ impl Sysopt {
 
     /// init the auto launch
     pub fn init_launch(&self) -> Result<()> {
-        let enable = { Config::verge().latest().enable_auto_launch };
-        let enable = enable.unwrap_or(false);
-
         let app_exe = current_exe()?;
         let app_exe = dunce::canonicalize(app_exe)?;
         let app_name = app_exe

+ 1 - 0
src/components/proxy/provider-button.tsx

@@ -55,6 +55,7 @@ export const ProviderButton = () => {
             <Typography variant="h6">{t("Proxy Provider")}</Typography>
             <Button
               variant="contained"
+              size="small"
               onClick={async () => {
                 Object.entries(data || {}).forEach(async ([key, item]) => {
                   await proxyProviderUpdate(key);

+ 1 - 0
src/components/rule/provider-button.tsx

@@ -53,6 +53,7 @@ export const ProviderButton = () => {
             <Typography variant="h6">{t("Rule Provider")}</Typography>
             <Button
               variant="contained"
+              size="small"
               onClick={async () => {
                 Object.entries(data || {}).forEach(async ([key, item]) => {
                   await ruleProviderUpdate(key);

+ 46 - 7
src/components/setting/mods/tun-viewer.tsx

@@ -5,8 +5,9 @@ import {
   List,
   ListItem,
   ListItemText,
-  MenuItem,
-  Select,
+  Box,
+  Typography,
+  Button,
   Switch,
   TextField,
 } from "@mui/material";
@@ -21,8 +22,8 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
 
   const [open, setOpen] = useState(false);
   const [values, setValues] = useState({
-    stack: "gVisor",
-    device: "Mihomo",
+    stack: "gvisor",
+    device: "Meta",
     autoRoute: true,
     autoDetectInterface: true,
     dnsHijack: ["any:53"],
@@ -34,8 +35,8 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
     open: () => {
       setOpen(true);
       setValues({
-        stack: clash?.tun.stack ?? "gVisor",
-        device: clash?.tun.device ?? "Mihomo",
+        stack: clash?.tun.stack ?? "gvisor",
+        device: clash?.tun.device ?? "Meta",
         autoRoute: clash?.tun["auto-route"] ?? true,
         autoDetectInterface: clash?.tun["auto-detect-interface"] ?? true,
         dnsHijack: clash?.tun["dns-hijack"] ?? ["any:53"],
@@ -74,7 +75,45 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
   return (
     <BaseDialog
       open={open}
-      title={t("Tun Mode")}
+      title={
+        <Box display="flex" justifyContent="space-between" gap={1}>
+          <Typography variant="h6">{t("Tun Mode")}</Typography>
+          <Button
+            variant="outlined"
+            size="small"
+            onClick={async () => {
+              let tun = {
+                stack: "gvisor",
+                device: "Meta",
+                "auto-route": true,
+                "auto-detect-interface": true,
+                "dns-hijack": ["any:53"],
+                "strict-route": false,
+                mtu: 9000,
+              };
+              setValues({
+                stack: "gvisor",
+                device: "Meta",
+                autoRoute: true,
+                autoDetectInterface: true,
+                dnsHijack: ["any:53"],
+                strictRoute: false,
+                mtu: 9000,
+              });
+              await patchClash({ tun });
+              await mutateClash(
+                (old) => ({
+                  ...(old! || {}),
+                  tun,
+                }),
+                false
+              );
+            }}
+          >
+            {t("Reset to Default")}
+          </Button>
+        </Box>
+      }
       contentSx={{ width: 450 }}
       okBtn={t("Save")}
       cancelBtn={t("Cancel")}

+ 1 - 0
src/locales/zh.json

@@ -167,6 +167,7 @@
   "Auto Detect Interface": "自动选择流量出口接口",
   "DNS Hijack": "DNS 劫持",
   "MTU": "最大传输单元",
+  "Reset to Default": "重置为默认值",
 
   "Portable Updater Error": "便携版不支持应用内更新,请手动下载替换",
   "Tun Mode Info Windows": "Tun模式需要授予内核相关权限,使用前请先开启服务模式",