Ver Fonte

update clashmeta core, Imporve UI, merge PR, reset icons, fix CI

wonfen há 1 ano atrás
pai
commit
bda87167a3
57 ficheiros alterados com 290 adições e 102 exclusões
  1. 11 0
      UPDATELOG.md
  2. 2 1
      package.json
  3. 81 0
      pnpm-lock.yaml
  4. 29 4
      scripts/check.mjs
  5. 1 1
      src-tauri/Cargo.lock
  6. 1 1
      src-tauri/Cargo.toml
  7. BIN
      src-tauri/icons/128x128.png
  8. BIN
      src-tauri/icons/128x128@2x.png
  9. BIN
      src-tauri/icons/32x32.png
  10. BIN
      src-tauri/icons/Square107x107Logo.png
  11. BIN
      src-tauri/icons/Square142x142Logo.png
  12. BIN
      src-tauri/icons/Square150x150Logo.png
  13. BIN
      src-tauri/icons/Square284x284Logo.png
  14. BIN
      src-tauri/icons/Square30x30Logo.png
  15. BIN
      src-tauri/icons/Square310x310Logo.png
  16. BIN
      src-tauri/icons/Square44x44Logo.png
  17. BIN
      src-tauri/icons/Square71x71Logo.png
  18. BIN
      src-tauri/icons/Square89x89Logo.png
  19. BIN
      src-tauri/icons/StoreLogo.png
  20. BIN
      src-tauri/icons/icon-new.icns
  21. BIN
      src-tauri/icons/icon-new.png
  22. BIN
      src-tauri/icons/icon-shrink.png
  23. BIN
      src-tauri/icons/icon.icns
  24. BIN
      src-tauri/icons/icon.ico
  25. BIN
      src-tauri/icons/icon.png
  26. BIN
      src-tauri/icons/tray-icon.ico
  27. BIN
      src-tauri/icons/tray-icon.png
  28. BIN
      src-tauri/icons/win-tray-icon-activated.png
  29. BIN
      src-tauri/icons/win-tray-icon.png
  30. 4 0
      src-tauri/src/config/verge.rs
  31. 42 4
      src-tauri/src/core/tray.rs
  32. 2 2
      src-tauri/src/utils/init.rs
  33. 1 1
      src-tauri/tauri.conf.json
  34. BIN
      src/assets/image/logo-box.png
  35. BIN
      src/assets/image/logo.ico
  36. BIN
      src/assets/image/logo.png
  37. 7 18
      src/assets/image/logo.svg
  38. 2 2
      src/assets/styles/layout.scss
  39. 19 26
      src/assets/styles/page.scss
  40. 7 5
      src/components/base/base-page.tsx
  41. 8 4
      src/components/layout/layout-item.tsx
  42. 1 1
      src/components/layout/use-custom-theme.ts
  43. 1 1
      src/components/profile/editor-viewer.tsx
  44. 3 3
      src/components/proxy/use-render-list.ts
  45. 18 5
      src/components/setting/mods/clash-core-viewer.tsx
  46. 19 2
      src/components/setting/setting-verge.tsx
  47. 4 0
      src/locales/en.json
  48. 2 0
      src/locales/ru.json
  49. 5 1
      src/locales/zh.json
  50. 1 1
      src/pages/_theme.tsx
  51. 2 2
      src/pages/connections.tsx
  52. 2 2
      src/pages/logs.tsx
  53. 2 2
      src/pages/profiles.tsx
  54. 2 3
      src/pages/proxies.tsx
  55. 2 2
      src/pages/rules.tsx
  56. 8 8
      src/pages/settings.tsx
  57. 1 0
      src/services/types.d.ts

+ 11 - 0
UPDATELOG.md

@@ -1,3 +1,14 @@
+## v1.4.1
+
+### Features
+
+- update clash meta core to newest 虚空终端(2023.11.23)
+- delete clash core UI
+- improve UI
+- change Logo to original
+
+---
+
 ## v1.4.0
 
 ### Features

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "clash-verge",
-  "version": "1.4.0",
+  "version": "1.4.1",
   "license": "GPL-3.0",
   "scripts": {
     "dev": "tauri dev -f default-meta",
@@ -42,6 +42,7 @@
     "react-virtuoso": "^3.1.3",
     "recoil": "^0.7.6",
     "snarkdown": "^2.0.0",
+    "tar": "^6.2.0",
     "swr": "^1.3.0"
   },
   "devDependencies": {

+ 81 - 0
pnpm-lock.yaml

@@ -80,6 +80,9 @@ dependencies:
   swr:
     specifier: ^1.3.0
     version: 1.3.0(react@18.2.0)
+  tar:
+    specifier: ^6.2.0
+    version: 6.2.0
 
 devDependencies:
   "@actions/github":
@@ -2180,6 +2183,14 @@ packages:
       fsevents: 2.3.2
     dev: true
 
+  /chownr@2.0.0:
+    resolution:
+      {
+        integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==,
+      }
+    engines: { node: ">=10" }
+    dev: false
+
   /clsx@2.0.0:
     resolution:
       {
@@ -2578,6 +2589,16 @@ packages:
       universalify: 2.0.0
     dev: true
 
+  /fs-minipass@2.1.0:
+    resolution:
+      {
+        integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==,
+      }
+    engines: { node: ">= 8" }
+    dependencies:
+      minipass: 3.3.6
+    dev: false
+
   /fsevents@2.3.2:
     resolution:
       {
@@ -2992,6 +3013,44 @@ packages:
       brace-expansion: 1.1.11
     dev: true
 
+  /minipass@3.3.6:
+    resolution:
+      {
+        integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==,
+      }
+    engines: { node: ">=8" }
+    dependencies:
+      yallist: 4.0.0
+    dev: false
+
+  /minipass@5.0.0:
+    resolution:
+      {
+        integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==,
+      }
+    engines: { node: ">=8" }
+    dev: false
+
+  /minizlib@2.1.2:
+    resolution:
+      {
+        integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==,
+      }
+    engines: { node: ">= 8" }
+    dependencies:
+      minipass: 3.3.6
+      yallist: 4.0.0
+    dev: false
+
+  /mkdirp@1.0.4:
+    resolution:
+      {
+        integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==,
+      }
+    engines: { node: ">=10" }
+    hasBin: true
+    dev: false
+
   /monaco-editor@0.34.1:
     resolution:
       {
@@ -3694,6 +3753,21 @@ packages:
       react: 18.2.0
     dev: false
 
+  /tar@6.2.0:
+    resolution:
+      {
+        integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==,
+      }
+    engines: { node: ">=10" }
+    dependencies:
+      chownr: 2.0.0
+      fs-minipass: 2.1.0
+      minipass: 5.0.0
+      minizlib: 2.1.2
+      mkdirp: 1.0.4
+      yallist: 4.0.0
+    dev: false
+
   /to-fast-properties@2.0.0:
     resolution:
       {
@@ -3897,6 +3971,13 @@ packages:
       }
     dev: true
 
+  /yallist@4.0.0:
+    resolution:
+      {
+        integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==,
+      }
+    dev: false
+
   /yaml@1.10.2:
     resolution:
       {

+ 29 - 4
scripts/check.mjs

@@ -1,5 +1,6 @@
 import fs from "fs-extra";
 import zlib from "zlib";
+import tar from "tar";
 import path from "path";
 import AdmZip from "adm-zip";
 import fetch from "node-fetch";
@@ -36,8 +37,8 @@ const CLASH_MAP = {
 };
 */
 /* ======= clash meta ======= */
-const META_URL_PREFIX = `https://github.com/wonfen/Clash.Meta/releases/download/`;
-const META_VERSION = "2023.11.23";
+const META_URL_PREFIX = `https://github.com/wonfen/Clash.Meta/releases/download/latest`;
+// const META_VERSION = "2023.11.23";
 
 const META_MAP = {
   "win32-x64": "clash.meta-win-amd64",
@@ -118,10 +119,14 @@ function clashS3() {
 function clashMeta() {
   const name = META_MAP[`${platform}-${arch}`];
   const isWin = platform === "win32";
-  const urlExt = isWin ? "zip" : "gz";
+  /*   const urlExt = isWin ? "zip" : "gz";
   const downloadURL = `${META_URL_PREFIX}${META_VERSION}/${name}-${META_VERSION}.${urlExt}`;
   const exeFile = `${name}${isWin ? ".exe" : ""}`;
-  const zipFile = `${name}-${META_VERSION}.${urlExt}`;
+  const zipFile = `${name}-${META_VERSION}.${urlExt}`; */
+  const urlExt = isWin ? "zip" : "tgz";
+  const downloadURL = `${META_URL_PREFIX}/${name}.${urlExt}`;
+  const exeFile = isWin ? "虚空终端-win-amd64.exe" : name;
+  const zipFile = `${name}.${urlExt}`;
 
   return {
     name: "clash-meta",
@@ -162,6 +167,26 @@ async function resolveSidecar(binInfo) {
       zip.extractAllTo(tempDir, true);
       await fs.rename(tempExe, sidecarPath);
       console.log(`[INFO]: "${name}" unzip finished`);
+    } else if (zipFile.endsWith(".tgz")) {
+      // tgz
+      await fs.mkdirp(tempDir);
+      await tar.extract({
+        cwd: tempDir,
+        file: tempZip,
+        //strip: 1, // 可能需要根据实际的 .tgz 文件结构调整
+      });
+      const files = await fs.readdir(tempDir);
+      console.log(`[DEBUG]: "${name}" files in tempDir:`, files);
+      const extractedFile = files.find((file) => file.startsWith("虚空终端-"));
+      if (extractedFile) {
+        const extractedFilePath = path.join(tempDir, extractedFile);
+        await fs.rename(extractedFilePath, sidecarPath);
+        console.log(`[INFO]: "${name}" file renamed to "${sidecarPath}"`);
+        execSync(`chmod 755 ${sidecarPath}`);
+        console.log(`[INFO]: "${name}" chmod binary finished`);
+      } else {
+        throw new Error(`Expected file not found in ${tempDir}`);
+      }
     } else {
       // gz
       const readStream = fs.createReadStream(tempZip);

+ 1 - 1
src-tauri/Cargo.lock

@@ -547,7 +547,7 @@ dependencies = [
 
 [[package]]
 name = "clash-verge"
-version = "1.4.0"
+version = "1.4.1"
 dependencies = [
  "anyhow",
  "auto-launch",

+ 1 - 1
src-tauri/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "clash-verge"
-version = "1.4.0"
+version = "1.4.1"
 description = "clash verge"
 authors = ["zzzgydi"]
 license = "GPL-3.0"

BIN
src-tauri/icons/128x128.png


BIN
src-tauri/icons/128x128@2x.png


BIN
src-tauri/icons/32x32.png


BIN
src-tauri/icons/Square107x107Logo.png


BIN
src-tauri/icons/Square142x142Logo.png


BIN
src-tauri/icons/Square150x150Logo.png


BIN
src-tauri/icons/Square284x284Logo.png


BIN
src-tauri/icons/Square30x30Logo.png


BIN
src-tauri/icons/Square310x310Logo.png


BIN
src-tauri/icons/Square44x44Logo.png


BIN
src-tauri/icons/Square71x71Logo.png


BIN
src-tauri/icons/Square89x89Logo.png


BIN
src-tauri/icons/StoreLogo.png


BIN
src-tauri/icons/icon-new.icns


BIN
src-tauri/icons/icon-new.png


BIN
src-tauri/icons/icon-shrink.png


BIN
src-tauri/icons/icon.icns


BIN
src-tauri/icons/icon.ico


BIN
src-tauri/icons/icon.png


BIN
src-tauri/icons/tray-icon.ico


BIN
src-tauri/icons/tray-icon.png


BIN
src-tauri/icons/win-tray-icon-activated.png


BIN
src-tauri/icons/win-tray-icon.png


+ 4 - 0
src-tauri/src/config/verge.rs

@@ -23,6 +23,9 @@ pub struct IVerge {
     /// maybe be able to set the alpha
     pub theme_blur: Option<bool>,
 
+    /// tray click event
+    pub tray_event: Option<String>,
+
     /// enable traffic graph default is true
     pub traffic_graph: Option<bool>,
 
@@ -166,6 +169,7 @@ impl IVerge {
         patch!(language);
         patch!(theme_mode);
         patch!(theme_blur);
+        patch!(tray_event);
         patch!(traffic_graph);
         patch!(enable_memory_usage);
 

+ 42 - 4
src-tauri/src/core/tray.rs

@@ -107,6 +107,20 @@ impl Tray {
     }
 
     pub fn update_part(app_handle: &AppHandle) -> Result<()> {
+        let zh = { Config::verge().latest().language == Some("zh".into()) };
+
+        let version = app_handle.package_info().version.to_string();
+
+        macro_rules! t {
+            ($en: expr, $zh: expr) => {
+                if zh {
+                    $zh
+                } else {
+                    $en
+                }
+            };
+        }
+
         let mode = {
             Config::clash()
                 .latest()
@@ -143,11 +157,39 @@ impl Tray {
         let _ = tray.get_item("system_proxy").set_selected(*system_proxy);
         let _ = tray.get_item("tun_mode").set_selected(*tun_mode);
 
+        let switch_map = {
+            let mut map = std::collections::HashMap::new();
+            map.insert(true, "on");
+            map.insert(false, "off");
+            map
+        };
+
+        #[cfg(not(target_os = "linux"))]
+        let _ = tray.set_tooltip(&format!(
+            "Clash Verge {version}\n{}: {}\n{}: {}",
+            t!("System Proxy", "系统代理"),
+            switch_map[system_proxy],
+            t!("TUN Mode", "Tun 模式"),
+            switch_map[tun_mode]
+        ));
+
         Ok(())
     }
 
+    pub fn on_left_click(app_handle: &AppHandle) {
+        let tray_event = { Config::verge().latest().tray_event.clone() };
+        let tray_event = tray_event.unwrap_or("main_window".into());
+        match tray_event.as_str() {
+            "system_proxy" => feat::toggle_system_proxy(),
+            "tun_mode" => feat::toggle_tun_mode(),
+            _ => resolve::create_window(app_handle),
+        }
+    }
+
     pub fn on_system_tray_event(app_handle: &AppHandle, event: SystemTrayEvent) {
         match event {
+            #[cfg(not(target_os = "linux"))]
+            SystemTrayEvent::LeftClick { .. } => Tray::on_left_click(app_handle),
             SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
                 mode @ ("rule_mode" | "global_mode" | "direct_mode" | "script_mode") => {
                     let mode = &mode[0..mode.len() - 5];
@@ -177,10 +219,6 @@ impl Tray {
                 }
                 _ => {}
             },
-            #[cfg(target_os = "windows")]
-            SystemTrayEvent::LeftClick { .. } => {
-                resolve::create_window(app_handle);
-            }
             _ => {}
         }
     }

+ 2 - 2
src-tauri/src/utils/init.rs

@@ -1,7 +1,7 @@
 use crate::config::*;
 use crate::utils::{dirs, help};
 use anyhow::Result;
-use chrono::{DateTime, Local};
+use chrono::{Local, TimeZone};
 use log::LevelFilter;
 use log4rs::append::console::ConsoleAppender;
 use log4rs::append::file::FileAppender;
@@ -116,7 +116,7 @@ pub fn delete_log() -> Result<()> {
         if file_name.ends_with(".log") {
             let now = Local::now();
             let created_time = parse_time_str(&file_name[0..file_name.len() - 4])?;
-            let file_time = DateTime::<Local>::from_local(created_time, now.offset().clone());
+            let file_time = Local.from_local_datetime(&created_time).single().ok_or(anyhow::anyhow!("invalid local datetime"))?;
 
             let duration = now.signed_duration_since(file_time);
             if duration.num_days() > day {

+ 1 - 1
src-tauri/tauri.conf.json

@@ -1,7 +1,7 @@
 {
   "package": {
     "productName": "Clash Verge",
-    "version": "1.4.0"
+    "version": "1.4.1"
   },
   "build": {
     "distDir": "../dist",

BIN
src/assets/image/logo-box.png


BIN
src/assets/image/logo.ico


BIN
src/assets/image/logo.png


Diff do ficheiro suprimidas por serem muito extensas
+ 7 - 18
src/assets/image/logo.svg


+ 2 - 2
src/assets/styles/layout.scss

@@ -5,7 +5,7 @@
   overflow: hidden;
 
   &__left {
-    flex: 1 0 25%;
+    flex: 1 0 15%;
     display: flex;
     height: 100%;
     max-width: 225px;
@@ -91,7 +91,7 @@
       top: 0;
       left: 0;
       right: 2px;
-      bottom: 10px;
+      bottom: 0px;
     }
   }
 }

+ 19 - 26
src/assets/styles/page.scss

@@ -6,43 +6,36 @@
 
   > header {
     flex: 0 0 58px;
-    width: 95%;
+    width: 100%;
     // max-width: 850px;
     margin: 0 auto;
-    padding-right: 4px;
+    padding-right: 8px;
     box-sizing: border-box;
     display: flex;
     align-items: center;
     justify-content: space-between;
   }
 
-  > section {
-    position: relative;
-    flex: 1 1 100%;
-    width: 100%;
+  .base-container {
     height: 100%;
-    overflow: auto;
-    padding: 8px 0;
-    box-sizing: border-box;
-    scrollbar-gutter: stable;
-    // background-color: var(--background-color);
-
-    .base-content {
-      width: 95%;
-      // max-width: 850px;
-      margin: 0 auto;
-      animation: baseContentIn 0.3s normal 1 forwards;
+    overflow: hidden;
+    border-radius: var(--border-radius);
 
-      @keyframes baseContentIn {
-        0% {
-          opacity: 0;
-          transform: translateY(50%) scale(0.9);
-        }
+    > section {
+      position: relative;
+      flex: 1 1 100%;
+      width: 100%;
+      height: 100%;
+      overflow: auto;
+      padding: 5px 5px;
+      box-sizing: border-box;
+      scrollbar-gutter: stable;
+      background-color: var(--background-color);
 
-        100% {
-          opacity: 1;
-          transform: translateY(0) scale(1);
-        }
+      .base-content {
+        width: 100%;
+        // max-width: 850px;
+        margin: 0 auto;
       }
     }
   }

+ 7 - 5
src/components/base/base-page.tsx

@@ -23,11 +23,13 @@ export const BasePage: React.FC<Props> = (props) => {
           {header}
         </header>
 
-        <section>
-          <div className="base-content" style={contentStyle} data-windrag>
-            {children}
-          </div>
-        </section>
+        <div className="base-container">
+          <section>
+            <div className="base-content" style={contentStyle} data-windrag>
+              {children}
+            </div>
+          </section>
+        </div>
       </div>
     </BaseErrorBoundary>
   );

+ 8 - 4
src/components/layout/layout-item.tsx

@@ -10,20 +10,24 @@ export const LayoutItem = (props: LinkProps) => {
   const navigate = useNavigate();
 
   return (
-    <ListItem sx={{ py: 0.5, maxWidth: 250, mx: "auto" }}>
+    <ListItem
+      sx={{ py: 0.5, maxWidth: 250, mx: "auto", padding: "4px 0px 4px 2px" }}
+    >
       <ListItemButton
         selected={!!match}
         sx={[
           {
-            borderRadius: 2,
+            borderTopLeftRadius: 18,
+            borderBottomLeftRadius: 18,
             textAlign: "center",
             "& .MuiListItemText-primary": { color: "text.secondary" },
           },
           ({ palette: { mode, primary } }) => {
-            const bgcolor =
+            /*             const bgcolor =
               mode === "light"
                 ? alpha(primary.main, 0.15)
-                : alpha(primary.main, 0.35);
+                : alpha(primary.main, 0.35); */
+            const bgcolor = mode === "light" ? "#ffffff" : "#0E1621";
             const color = mode === "light" ? primary.main : primary.light;
 
             return {

+ 1 - 1
src/components/layout/use-custom-theme.ts

@@ -84,7 +84,7 @@ export const useCustomTheme = () => {
     }
 
     // css
-    const backgroundColor = mode === "light" ? "#ffffff" : "#121212";
+    const backgroundColor = mode === "light" ? "#ffffff" : "#0E1621";
     const selectColor = mode === "light" ? "#f5f5f5" : "#d5d5d5";
     const scrollColor = mode === "light" ? "#90939980" : "#54545480";
 

+ 1 - 1
src/components/profile/editor-viewer.tsx

@@ -78,7 +78,7 @@ export const EditorViewer = (props: Props) => {
       <DialogTitle>{t("Edit File")}</DialogTitle>
 
       <DialogContent sx={{ width: "95%", pb: 1, userSelect: "text" }}>
-        <div style={{ width: "100%", height: "420px" }} ref={editorRef} />
+        <div style={{ width: "100%", height: "500px" }} ref={editorRef} />
       </DialogContent>
 
       <DialogActions>

+ 3 - 3
src/components/proxy/use-render-list.ts

@@ -35,9 +35,9 @@ export const useRenderList = (mode: string) => {
 
   // 自适应
   if (col >= 6 || col <= 0) {
-    if (width > 1450) col = 5;
-    else if (width > 1024) col = 4;
-    else if (width > 900) col = 3;
+    if (width > 1450) col = 4;
+    else if (width > 1024) col = 3;
+    else if (width > 900) col = 2;
     else if (width >= 600) col = 2;
     else col = 1;
   }

+ 18 - 5
src/components/setting/mods/clash-core-viewer.tsx

@@ -18,10 +18,11 @@ import { closeAllConnections } from "@/services/api";
 import { grantPermission } from "@/services/cmds";
 import getSystem from "@/utils/get-system";
 
-const VALID_CORE = [
+/* const VALID_CORE = [
   { name: "Clash", core: "clash" },
   { name: "Clash Meta", core: "clash-meta" },
-];
+]; */
+const VALID_CORE = [{ name: "Clash Meta", core: "clash-meta" }];
 
 const OS = getSystem();
 
@@ -91,7 +92,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
       contentSx={{
         pb: 0,
         width: 320,
-        height: 200,
+        height: 90,
         overflowY: "auto",
         userSelect: "text",
         marginTop: "-8px",
@@ -111,7 +112,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
             <ListItemText primary={each.name} secondary={`/${each.core}`} />
 
             {(OS === "macos" || OS === "linux") && (
-              <IconButton
+              /*               <IconButton
                 color="inherit"
                 size="small"
                 edge="end"
@@ -122,7 +123,19 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
                 }}
               >
                 <Lock fontSize="inherit" />
-              </IconButton>
+              </IconButton> */
+              <Button
+                variant="outlined"
+                size="small"
+                title={t("Tun mode requires")}
+                onClick={(e) => {
+                  e.preventDefault();
+                  e.stopPropagation();
+                  onGrant(each.core);
+                }}
+              >
+                {t("Grant")}
+              </Button>
             )}
           </ListItemButton>
         ))}

+ 19 - 2
src/components/setting/setting-verge.tsx

@@ -29,8 +29,7 @@ const SettingVerge = ({ onError }: Props) => {
   const { t } = useTranslation();
 
   const { verge, patchVerge, mutateVerge } = useVerge();
-  const { theme_mode, language } = verge ?? {};
-
+  const { theme_mode, language, tray_event } = verge ?? {};
   const configRef = useRef<DialogRef>(null);
   const hotkeyRef = useRef<DialogRef>(null);
   const miscRef = useRef<DialogRef>(null);
@@ -91,6 +90,24 @@ const SettingVerge = ({ onError }: Props) => {
         </GuardState>
       </SettingItem>
 
+      {OS !== "linux" && (
+        <SettingItem label={t("Tray Click Event")}>
+          <GuardState
+            value={tray_event ?? "main_window"}
+            onCatch={onError}
+            onFormat={(e: any) => e.target.value}
+            onChange={(e) => onChangeData({ tray_event: e })}
+            onGuard={(e) => patchVerge({ tray_event: e })}
+          >
+            <Select size="small" sx={{ width: 140, "> div": { py: "7.5px" } }}>
+              <MenuItem value="main_window">{t("Show Main Window")}</MenuItem>
+              <MenuItem value="system_proxy">{t("System Proxy")}</MenuItem>
+              <MenuItem value="tun_mode">{t("Tun Mode")}</MenuItem>
+            </Select>
+          </GuardState>
+        </SettingItem>
+      )}
+
       <SettingItem label={t("Theme Setting")}>
         <IconButton
           color="inherit"

+ 4 - 0
src/locales/en.json

@@ -69,6 +69,8 @@
   "Mixed Port": "Mixed Port",
   "External": "External",
   "Clash Core": "Clash Core",
+  "Grant": "Grant",
+  "Tun mode requires": "Tun mode requires",
   "Tun Mode": "Tun Mode",
   "Service Mode": "Service Mode",
   "Auto Launch": "Auto Launch",
@@ -85,6 +87,8 @@
   "Current System Proxy": "Current System Proxy",
   "Theme Mode": "Theme Mode",
   "Theme Blur": "Theme Blur",
+  "Tray Click Event": "Tray Click Event",
+  "Show Main Window": "Show Main Window",
   "Theme Setting": "Theme Setting",
   "Layout Setting": "Layout Setting",
   "Miscellaneous": "Miscellaneous",

+ 2 - 0
src/locales/ru.json

@@ -78,6 +78,8 @@
   "Current System Proxy": "Текущий системный прокси",
   "Theme Mode": "Режим темы",
   "Theme Blur": "Размытие темы",
+  "Tray Click Event": "Событие щелчка в лотке",
+  "Show Main Window": "Показать главное окно",
   "Theme Setting": "Настройка темы",
   "Hotkey Setting": "Настройка клавиатурных сокращений",
   "Traffic Graph": "График трафика",

+ 5 - 1
src/locales/zh.json

@@ -69,6 +69,8 @@
   "Mixed Port": "端口设置",
   "External": "外部控制",
   "Clash Core": "Clash 内核",
+  "Grant": "授权",
+  "Tun mode requires": "如需启用TUN模式需要授权",
   "Tun Mode": "Tun 模式",
   "Service Mode": "服务模式",
   "Auto Launch": "开机自启",
@@ -85,6 +87,8 @@
   "Bypass": "当前绕过:",
   "Theme Mode": "主题模式",
   "Theme Blur": "背景模糊",
+  "Tray Click Event": "托盘点击事件",
+  "Show Main Window": "显示主窗口",
   "Theme Setting": "主题设置",
   "Layout Setting": "界面设置",
   "Miscellaneous": "杂项设置",
@@ -101,7 +105,7 @@
   "theme.dark": "深色",
   "theme.system": "系统",
   "Clash Field": "Clash 字段",
-  "Runtime Config": "运行订阅",
+  "Runtime Config": "当前配置",
   "ReadOnly": "只读",
   "Restart": "重启内核",
 

+ 1 - 1
src/pages/_theme.tsx

@@ -8,7 +8,7 @@ export const defaultTheme = {
   error_color: "#d32f2f",
   warning_color: "#ed6c02",
   success_color: "#2e7d32",
-  font_family: `"Roboto", "Helvetica", "Arial", sans-serif, "twemoji mozilla"`,
+  font_family: `"twemoji mozilla", "Roboto", "Helvetica", "Arial", sans-serif`,
 };
 
 // dark mode

+ 2 - 2
src/pages/connections.tsx

@@ -142,7 +142,7 @@ const ConnectionsPage = () => {
         </Box>
       }
     >
-      <Paper sx={{ boxShadow: 0, height: "100%" }}>
+      <Box sx={{ boxShadow: 0, height: "100%" }}>
         <Box
           sx={{
             pt: 1,
@@ -210,7 +210,7 @@ const ConnectionsPage = () => {
         </Box>
 
         <ConnectionDetail ref={detailRef} />
-      </Paper>
+      </Box>
     </BasePage>
   );
 };

+ 2 - 2
src/pages/logs.tsx

@@ -64,7 +64,7 @@ const LogPage = () => {
         </Box>
       }
     >
-      <Paper
+      <Box
         sx={{
           boxSizing: "border-box",
           boxShadow: 0,
@@ -121,7 +121,7 @@ const LogPage = () => {
             <BaseEmpty text="No Logs" />
           )}
         </Box>
-      </Paper>
+      </Box>
     </BasePage>
   );
 };

+ 2 - 2
src/pages/profiles.tsx

@@ -295,7 +295,7 @@ const ProfilePage = () => {
       </Stack>
 
       <Box sx={{ mb: 4.5 }}>
-        <Grid container spacing={{ xs: 2, lg: 3 }}>
+        <Grid container spacing={{ xs: 1, lg: 1 }}>
           {regularItems.map((item) => (
             <Grid item xs={12} sm={6} md={4} lg={3} key={item.file}>
               <ProfileItem
@@ -311,7 +311,7 @@ const ProfilePage = () => {
       </Box>
 
       {enhanceItems.length > 0 && (
-        <Grid container spacing={{ xs: 2, lg: 3 }}>
+        <Grid container spacing={{ xs: 2, lg: 2 }}>
           {enhanceItems.map((item) => (
             <Grid item xs={12} sm={6} md={4} lg={3} key={item.file}>
               <ProfileMore

+ 2 - 3
src/pages/proxies.tsx

@@ -72,17 +72,16 @@ const ProxyPage = () => {
         </Box>
       }
     >
-      <Paper
+      <Box
         sx={{
           borderRadius: 1,
           boxShadow: 0,
           height: "100%",
           boxSizing: "border-box",
-          py: 1,
         }}
       >
         <ProxyGroups mode={curMode!} />
-      </Paper>
+      </Box>
     </BasePage>
   );
 };

+ 2 - 2
src/pages/rules.tsx

@@ -19,7 +19,7 @@ const RulesPage = () => {
 
   return (
     <BasePage title={t("Rules")} contentStyle={{ height: "100%" }}>
-      <Paper sx={{ boxSizing: "border-box", boxShadow: 0, height: "100%" }}>
+      <Box sx={{ boxSizing: "border-box", boxShadow: 0, height: "100%" }}>
         <Box
           sx={{
             pt: 1,
@@ -57,7 +57,7 @@ const RulesPage = () => {
             <BaseEmpty text="No Rules" />
           )}
         </Box>
-      </Paper>
+      </Box>
     </BasePage>
   );
 };

+ 8 - 8
src/pages/settings.tsx

@@ -1,4 +1,4 @@
-import { Grid, IconButton, Paper } from "@mui/material";
+import { Box, Grid, IconButton, Paper } from "@mui/material";
 import { useLockFn } from "ahooks";
 import { useTranslation } from "react-i18next";
 import { BasePage, Notice } from "@/components/base";
@@ -33,19 +33,19 @@ const SettingPage = () => {
         </IconButton>
       }
     >
-      <Grid container spacing={{ xs: 2, lg: 3 }}>
+      <Grid container spacing={{ xs: 1, lg: 1 }}>
         <Grid item xs={12} md={6}>
-          <Paper sx={{ borderRadius: 1, boxShadow: 2, marginBottom: 2 }}>
+          <Box sx={{ borderRadius: 1, boxShadow: 2, marginBottom: 1 }}>
             <SettingSystem onError={onError} />
-          </Paper>
-          <Paper sx={{ borderRadius: 1, boxShadow: 2 }}>
+          </Box>
+          <Box sx={{ borderRadius: 1, boxShadow: 2 }}>
             <SettingClash onError={onError} />
-          </Paper>
+          </Box>
         </Grid>
         <Grid item xs={12} md={6}>
-          <Paper sx={{ borderRadius: 1, boxShadow: 2 }}>
+          <Box sx={{ borderRadius: 1, boxShadow: 2 }}>
             <SettingVerge onError={onError} />
-          </Paper>
+          </Box>
         </Grid>
       </Grid>
     </BasePage>

+ 1 - 0
src/services/types.d.ts

@@ -155,6 +155,7 @@ interface IProfilesConfig {
 interface IVergeConfig {
   app_log_level?: "trace" | "debug" | "info" | "warn" | "error" | string;
   language?: string;
+  tray_event?: "main_window" | "system_proxy" | "tun_mode" | string;
   clash_core?: string;
   theme_mode?: "light" | "dark" | "system";
   theme_blur?: boolean;

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff