mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 10:22:07 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f59be465ea | ||
|
|
27305317ce | ||
|
|
8378320e50 | ||
|
|
86a69952db | ||
|
|
e212ebfdb9 | ||
|
|
f235125d48 | ||
|
|
8efa815eb9 | ||
|
|
e54d42576b | ||
|
|
1e18539862 | ||
|
|
673fdf4721 | ||
|
|
57d6bfba51 | ||
|
|
8fa23aecda | ||
|
|
f9c10533e8 | ||
|
|
c891c3723e | ||
|
|
a0625ef2e7 | ||
|
|
b2774abb54 | ||
|
|
fa089bbc40 | ||
|
|
8437d1763f |
@@ -1,7 +1,7 @@
|
|||||||
pnpm install
|
pnpm install
|
||||||
pnpm check $INPUT_TARGET
|
pnpm check $INPUT_TARGET
|
||||||
sed -i "s/#openssl/openssl={version=\"0.10\",features=[\"vendored\"]}/g" src-tauri/Cargo.toml
|
sed -i "s/#openssl/openssl={version=\"0.10\",features=[\"vendored\"]}/g" src-tauri/Cargo.toml
|
||||||
if [ "$INPUT_TARGET" = "x86_64-unknown-linux-gnu" ] || [ "$INPUT_TARGET" = "i686-unknown-linux-gnu" ]; then
|
if [ "$INPUT_TARGET" = "x86_64-unknown-linux-gnu" ]; then
|
||||||
pnpm build --target $INPUT_TARGET
|
pnpm build --target $INPUT_TARGET
|
||||||
else
|
else
|
||||||
pnpm build --target $INPUT_TARGET -b deb
|
pnpm build --target $INPUT_TARGET -b deb
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ rustup target add "$INPUT_TARGET"
|
|||||||
if [ "$INPUT_TARGET" = "x86_64-unknown-linux-gnu" ]; then
|
if [ "$INPUT_TARGET" = "x86_64-unknown-linux-gnu" ]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
||||||
elif [ "$INPUT_TARGET" = "i686-unknown-linux-gnu" ]; then
|
|
||||||
dpkg --add-architecture i386
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y libstdc++6:i386 libgdk-pixbuf2.0-dev:i386 libatomic1:i386 gcc-multilib g++-multilib libwebkit2gtk-4.0-dev:i386 libssl-dev:i386 libgtk-3-dev:i386 librsvg2-dev:i386 patchelf:i386 libayatana-appindicator3-dev:i386
|
|
||||||
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
|
|
||||||
export PKG_CONFIG_SYSROOT_DIR=/
|
|
||||||
elif [ "$INPUT_TARGET" = "aarch64-unknown-linux-gnu" ]; then
|
elif [ "$INPUT_TARGET" = "aarch64-unknown-linux-gnu" ]; then
|
||||||
dpkg --add-architecture arm64
|
dpkg --add-architecture arm64
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
name: Alpha Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags-ignore: [updater, alpha]
|
||||||
|
permissions: write-all
|
||||||
|
env:
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
RUST_BACKTRACE: short
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
alpha:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
- os: windows-latest
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
|
- os: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Apply Patch
|
||||||
|
if: matrix.target == 'aarch64-pc-windows-msvc'
|
||||||
|
run: |
|
||||||
|
git config --global user.email "clash-verge-rev@github.io"
|
||||||
|
git config --global user.name "clash-verge-rev"
|
||||||
|
git am patches/support-windows-aarch64.patch
|
||||||
|
|
||||||
|
- name: Init Submodule
|
||||||
|
if: matrix.target == 'aarch64-pc-windows-msvc'
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
|
||||||
|
- name: Install Rust Stable
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Add Rust Target
|
||||||
|
run: rustup target add ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: src-tauri
|
||||||
|
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
name: Install pnpm
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Pnpm install and check
|
||||||
|
run: |
|
||||||
|
pnpm i
|
||||||
|
pnpm check ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Tauri build
|
||||||
|
uses: tauri-apps/tauri-action@v0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||||
|
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||||
|
with:
|
||||||
|
tagName: alpha
|
||||||
|
releaseName: "Clash Verge Rev Alpha"
|
||||||
|
releaseBody: "More new features are now supported."
|
||||||
|
releaseDraft: false
|
||||||
|
prerelease: true
|
||||||
|
tauriScript: pnpm
|
||||||
|
args: --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Portable Bundle
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
run: pnpm portable ${{ matrix.target }} --alpha
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||||
|
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||||
|
|
||||||
|
alpha-for-linux:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build for Linux
|
||||||
|
uses: ./.github/build-for-linux
|
||||||
|
env:
|
||||||
|
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||||
|
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
- name: Get Version
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install jq
|
||||||
|
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
||||||
|
- name: Upload Release
|
||||||
|
if: startsWith(matrix.target, 'x86_64')
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: alpha
|
||||||
|
name: "Clash Verge Rev Alpha"
|
||||||
|
body: "More new features are now supported."
|
||||||
|
prerelease: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
|
||||||
|
- name: Upload Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: alpha
|
||||||
|
name: "Clash Verge Rev Alpha"
|
||||||
|
body: "More new features are now supported."
|
||||||
|
prerelease: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
|
||||||
|
update_tag:
|
||||||
|
name: Update tag
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [alpha, alpha-for-linux]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set Env
|
||||||
|
run: |
|
||||||
|
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
|
- name: Update Tag
|
||||||
|
uses: richardsimko/update-tag@v1
|
||||||
|
with:
|
||||||
|
tag_name: alpha
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- run: |
|
||||||
|
cat > release.txt << 'EOF'
|
||||||
|
## Clash Verge Rev Alpha
|
||||||
|
Created at ${{ env.BUILDTIME }}.
|
||||||
|
EOF
|
||||||
|
- name: Upload Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: alpha
|
||||||
|
name: "Clash Verge Rev Alpha"
|
||||||
|
body_path: release.txt
|
||||||
|
prerelease: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
generate_release_notes: true
|
||||||
@@ -2,9 +2,6 @@ name: Release Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v**
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
@@ -18,8 +15,6 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
- os: windows-latest
|
|
||||||
target: i686-pc-windows-msvc
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-pc-windows-msvc
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -78,7 +73,7 @@ jobs:
|
|||||||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||||
with:
|
with:
|
||||||
tagName: v__VERSION__
|
tagName: v__VERSION__
|
||||||
releaseName: "Clash Verge v__VERSION__"
|
releaseName: "Clash Verge Rev v__VERSION__"
|
||||||
releaseBody: "More new features are now supported."
|
releaseBody: "More new features are now supported."
|
||||||
releaseDraft: false
|
releaseDraft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
@@ -100,12 +95,8 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
- os: ubuntu-latest
|
|
||||||
target: i686-unknown-linux-gnu
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
target: aarch64-unknown-linux-gnu
|
target: aarch64-unknown-linux-gnu
|
||||||
# - os: ubuntu-latest
|
|
||||||
# target: armv7-unknown-linux-gnueabihf
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
@@ -124,11 +115,11 @@ jobs:
|
|||||||
sudo apt-get install jq
|
sudo apt-get install jq
|
||||||
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
if: startsWith(matrix.target, 'x86_64') || startsWith(matrix.target, 'i686')
|
if: startsWith(matrix.target, 'x86_64')
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: v${{env.VERSION}}
|
tag_name: v${{env.VERSION}}
|
||||||
name: "Clash Verge v${{env.VERSION}}"
|
name: "Clash Verge Rev v${{env.VERSION}}"
|
||||||
body: "More new features are now supported."
|
body: "More new features are now supported."
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
|
files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
|
||||||
@@ -136,21 +127,20 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: v${{env.VERSION}}
|
tag_name: v${{env.VERSION}}
|
||||||
name: "Clash Verge v${{env.VERSION}}"
|
name: "Clash Verge Rev v${{env.VERSION}}"
|
||||||
body: "More new features are now supported."
|
body: "More new features are now supported."
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
|
files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
|
||||||
|
|
||||||
release-update:
|
release-update:
|
||||||
needs: [release]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
needs: [release, release-for-linux]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
|
|
||||||
|
|||||||
@@ -13,18 +13,15 @@ A Clash Meta GUI based on <a href="https://github.com/tauri-apps/tauri">Tauri</a
|
|||||||
|
|
||||||
Click on the corresponding link below to download the installation package. Supports Windows (x64/x86), Linux (x64/arm64) and macOS 10.15+ (intel/apple).
|
Click on the corresponding link below to download the installation package. Supports Windows (x64/x86), Linux (x64/arm64) and macOS 10.15+ (intel/apple).
|
||||||
|
|
||||||
[[Windows x64](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/Clash.Verge_1.5.1_x64-setup.exe)]
|
[[Windows x64](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/Clash.Verge_1.5.2_x64-setup.exe)]
|
||||||
[[Windows x86](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/Clash.Verge_1.5.1_x86-setup.exe)]
|
[[Windows arm64](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/Clash.Verge_1.5.2_arm64-setup.exe)]
|
||||||
[[Windows arm64](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/Clash.Verge_1.5.1_arm64-setup.exe)]
|
|
||||||
|
|
||||||
[[macOS intel](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/Clash.Verge_1.5.1_x64.dmg)]
|
[[macOS intel](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/Clash.Verge_1.5.2_x64.dmg)]
|
||||||
[[macOS apple](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/Clash.Verge_1.5.1_aarch64.dmg)]
|
[[macOS apple](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/Clash.Verge_1.5.2_aarch64.dmg)]
|
||||||
|
|
||||||
[[Linux x64 AppImage](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/clash-verge_1.5.1_amd64.AppImage)]
|
[[Linux x64 AppImage](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/clash-verge_1.5.2_amd64.AppImage)]
|
||||||
[[Linux x64 deb](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/clash-verge_1.5.1_amd64.deb)]
|
[[Linux x64 deb](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/clash-verge_1.5.2_amd64.deb)]
|
||||||
[[Linux x86 AppImage](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/clash-verge_1.5.1_i386.AppImage)]
|
[[Linux arm64 deb](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.2/clash-verge_1.5.2_arm64.deb)]
|
||||||
[[Linux x86 deb](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/clash-verge_1.5.1_i386.deb)]
|
|
||||||
[[Linux arm64 deb](https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v1.5.1/clash-verge_1.5.1_arm64.deb)]
|
|
||||||
|
|
||||||
Or you can build it yourself. Supports Windows, Linux and macOS 10.15+
|
Or you can build it yourself. Supports Windows, Linux and macOS 10.15+
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
|
## v1.5.2
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- 支持自定义延迟测试超时时间
|
||||||
|
- 优化 Tun 相关设置
|
||||||
|
|
||||||
|
### Bugs Fixes
|
||||||
|
|
||||||
|
- Merge 操作出错
|
||||||
|
- 安装后重启服务
|
||||||
|
- 修复管理员权限启动时开机启动失效的问题
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v1.5.1
|
## v1.5.1
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- 保存窗口最大化状态
|
- 保存窗口最大化状态
|
||||||
- Proxy Provider 显示数量
|
- Proxy Provider 显示数量
|
||||||
|
- 不再提供 32 位安装包(因为 32 位经常出现各种奇怪问题,比如 tun 模式无法开启;现在系统也几乎没有 32 位了)
|
||||||
|
|
||||||
### Bugs Fixes
|
### Bugs Fixes
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clash-verge",
|
"name": "clash-verge",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tauri dev",
|
"dev": "tauri dev",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
From 8b085aea2f11e64f433244eda092c178a2bb50bc Mon Sep 17 00:00:00 2001
|
From 871c9a6d1ed014c93da2436a437df03734e9f76c Mon Sep 17 00:00:00 2001
|
||||||
From: MystiPanda <mystipanda@proton.me>
|
From: MystiPanda <mystipanda@proton.me>
|
||||||
Date: Sun, 10 Dec 2023 19:47:45 +0800
|
Date: Sun, 10 Dec 2023 19:47:45 +0800
|
||||||
Subject: [PATCH] feat: Support windows aarch64
|
Subject: [PATCH] feat: Support windows aarch64
|
||||||
@@ -22,7 +22,7 @@ index 0000000..2eda7e4
|
|||||||
+ path = src-tauri/quick-rs
|
+ path = src-tauri/quick-rs
|
||||||
+ url = https://github.com/clash-verge-rev/quick-rs.git
|
+ url = https://github.com/clash-verge-rev/quick-rs.git
|
||||||
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
|
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
|
||||||
index 4c6dde5..5fd9ad8 100644
|
index 2f1a3be..d67f6ed 100644
|
||||||
--- a/src-tauri/Cargo.toml
|
--- a/src-tauri/Cargo.toml
|
||||||
+++ b/src-tauri/Cargo.toml
|
+++ b/src-tauri/Cargo.toml
|
||||||
@@ -25,7 +25,6 @@ log4rs = "1"
|
@@ -25,7 +25,6 @@ log4rs = "1"
|
||||||
@@ -32,8 +32,8 @@ index 4c6dde5..5fd9ad8 100644
|
|||||||
-rquickjs = "0.3" # 高版本不支持 Linux aarch64
|
-rquickjs = "0.3" # 高版本不支持 Linux aarch64
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
auto-launch = "0.5"
|
once_cell = "1.18"
|
||||||
@@ -34,6 +33,7 @@ port_scanner = "0.1.5"
|
@@ -33,6 +32,7 @@ port_scanner = "0.1.5"
|
||||||
delay_timer = "0.11.5"
|
delay_timer = "0.11.5"
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
percent-encoding = "2.3.1"
|
percent-encoding = "2.3.1"
|
||||||
@@ -49,7 +49,7 @@ index 0000000..78277c4
|
|||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+Subproject commit 78277c4509c64f18c0fc5c9f2b84671de7c83343
|
+Subproject commit 78277c4509c64f18c0fc5c9f2b84671de7c83343
|
||||||
diff --git a/src-tauri/src/enhance/script.rs b/src-tauri/src/enhance/script.rs
|
diff --git a/src-tauri/src/enhance/script.rs b/src-tauri/src/enhance/script.rs
|
||||||
index 6c207d9..d47dc33 100644
|
index 30a922f..d47dc33 100644
|
||||||
--- a/src-tauri/src/enhance/script.rs
|
--- a/src-tauri/src/enhance/script.rs
|
||||||
+++ b/src-tauri/src/enhance/script.rs
|
+++ b/src-tauri/src/enhance/script.rs
|
||||||
@@ -3,61 +3,83 @@ use anyhow::Result;
|
@@ -3,61 +3,83 @@ use anyhow::Result;
|
||||||
|
|||||||
+33
-8
@@ -13,24 +13,20 @@ const FORCE = process.argv.includes("--force");
|
|||||||
|
|
||||||
const PLATFORM_MAP = {
|
const PLATFORM_MAP = {
|
||||||
"x86_64-pc-windows-msvc": "win32",
|
"x86_64-pc-windows-msvc": "win32",
|
||||||
"i686-pc-windows-msvc": "win32",
|
|
||||||
"aarch64-pc-windows-msvc": "win32",
|
"aarch64-pc-windows-msvc": "win32",
|
||||||
"x86_64-apple-darwin": "darwin",
|
"x86_64-apple-darwin": "darwin",
|
||||||
"aarch64-apple-darwin": "darwin",
|
"aarch64-apple-darwin": "darwin",
|
||||||
"x86_64-unknown-linux-gnu": "linux",
|
"x86_64-unknown-linux-gnu": "linux",
|
||||||
"i686-unknown-linux-gnu": "linux",
|
|
||||||
"aarch64-unknown-linux-gnu": "linux",
|
"aarch64-unknown-linux-gnu": "linux",
|
||||||
"armv7-unknown-linux-gnueabihf": "linux",
|
"armv7-unknown-linux-gnueabihf": "linux",
|
||||||
"loongarch64-unknown-linux-gnu": "linux",
|
"loongarch64-unknown-linux-gnu": "linux",
|
||||||
};
|
};
|
||||||
const ARCH_MAP = {
|
const ARCH_MAP = {
|
||||||
"x86_64-pc-windows-msvc": "x64",
|
"x86_64-pc-windows-msvc": "x64",
|
||||||
"i686-pc-windows-msvc": "ia32",
|
|
||||||
"aarch64-pc-windows-msvc": "arm64",
|
"aarch64-pc-windows-msvc": "arm64",
|
||||||
"x86_64-apple-darwin": "x64",
|
"x86_64-apple-darwin": "x64",
|
||||||
"aarch64-apple-darwin": "arm64",
|
"aarch64-apple-darwin": "arm64",
|
||||||
"x86_64-unknown-linux-gnu": "x64",
|
"x86_64-unknown-linux-gnu": "x64",
|
||||||
"i686-unknown-linux-gnu": "ia32",
|
|
||||||
"aarch64-unknown-linux-gnu": "arm64",
|
"aarch64-unknown-linux-gnu": "arm64",
|
||||||
"armv7-unknown-linux-gnueabihf": "arm",
|
"armv7-unknown-linux-gnueabihf": "arm",
|
||||||
"loongarch64-unknown-linux-gnu": "loong64",
|
"loongarch64-unknown-linux-gnu": "loong64",
|
||||||
@@ -57,12 +53,10 @@ let META_ALPHA_VERSION;
|
|||||||
|
|
||||||
const META_ALPHA_MAP = {
|
const META_ALPHA_MAP = {
|
||||||
"win32-x64": "mihomo-windows-amd64-compatible",
|
"win32-x64": "mihomo-windows-amd64-compatible",
|
||||||
"win32-ia32": "mihomo-windows-386",
|
|
||||||
"win32-arm64": "mihomo-windows-arm64",
|
"win32-arm64": "mihomo-windows-arm64",
|
||||||
"darwin-x64": "mihomo-darwin-amd64",
|
"darwin-x64": "mihomo-darwin-amd64",
|
||||||
"darwin-arm64": "mihomo-darwin-arm64",
|
"darwin-arm64": "mihomo-darwin-arm64",
|
||||||
"linux-x64": "mihomo-linux-amd64-compatible",
|
"linux-x64": "mihomo-linux-amd64-compatible",
|
||||||
"linux-ia32": "mihomo-linux-386",
|
|
||||||
"linux-arm64": "mihomo-linux-arm64",
|
"linux-arm64": "mihomo-linux-arm64",
|
||||||
"linux-arm": "mihomo-linux-armv7",
|
"linux-arm": "mihomo-linux-armv7",
|
||||||
"linux-loong64": "mihomo-linux-loong64",
|
"linux-loong64": "mihomo-linux-loong64",
|
||||||
@@ -103,12 +97,10 @@ let META_VERSION;
|
|||||||
|
|
||||||
const META_MAP = {
|
const META_MAP = {
|
||||||
"win32-x64": "mihomo-windows-amd64-compatible",
|
"win32-x64": "mihomo-windows-amd64-compatible",
|
||||||
"win32-ia32": "mihomo-windows-386",
|
|
||||||
"win32-arm64": "mihomo-windows-arm64",
|
"win32-arm64": "mihomo-windows-arm64",
|
||||||
"darwin-x64": "mihomo-darwin-amd64",
|
"darwin-x64": "mihomo-darwin-amd64",
|
||||||
"darwin-arm64": "mihomo-darwin-arm64",
|
"darwin-arm64": "mihomo-darwin-arm64",
|
||||||
"linux-x64": "mihomo-linux-amd64-compatible",
|
"linux-x64": "mihomo-linux-amd64-compatible",
|
||||||
"linux-ia32": "mihomo-linux-386",
|
|
||||||
"linux-arm64": "mihomo-linux-arm64",
|
"linux-arm64": "mihomo-linux-arm64",
|
||||||
"linux-arm": "mihomo-linux-armv7",
|
"linux-arm": "mihomo-linux-armv7",
|
||||||
"linux-loong64": "mihomo-linux-loong64",
|
"linux-loong64": "mihomo-linux-loong64",
|
||||||
@@ -317,6 +309,38 @@ async function downloadFile(url, path) {
|
|||||||
console.log(`[INFO]: download finished "${url}"`);
|
console.log(`[INFO]: download finished "${url}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SimpleSC.dll
|
||||||
|
const resolvePlugin = async () => {
|
||||||
|
const url =
|
||||||
|
"https://nsis.sourceforge.io/mediawiki/images/e/ef/NSIS_Simple_Service_Plugin_Unicode_1.30.zip";
|
||||||
|
|
||||||
|
const tempDir = path.join(TEMP_DIR, "SimpleSC");
|
||||||
|
const tempZip = path.join(
|
||||||
|
tempDir,
|
||||||
|
"NSIS_Simple_Service_Plugin_Unicode_1.30.zip"
|
||||||
|
);
|
||||||
|
const tempDll = path.join(tempDir, "SimpleSC.dll");
|
||||||
|
const pluginDir = path.join(process.env.APPDATA, "Local/NSIS");
|
||||||
|
const pluginPath = path.join(pluginDir, "SimpleSC.dll");
|
||||||
|
await fs.mkdirp(pluginDir);
|
||||||
|
await fs.mkdirp(tempDir);
|
||||||
|
if (!FORCE && (await fs.pathExists(pluginPath))) return;
|
||||||
|
try {
|
||||||
|
if (!(await fs.pathExists(tempZip))) {
|
||||||
|
await downloadFile(url, tempZip);
|
||||||
|
}
|
||||||
|
const zip = new AdmZip(tempZip);
|
||||||
|
zip.getEntries().forEach((entry) => {
|
||||||
|
console.log(`[DEBUG]: "SimpleSC" entry name`, entry.entryName);
|
||||||
|
});
|
||||||
|
zip.extractAllTo(tempDir, true);
|
||||||
|
await fs.copyFile(tempDll, pluginPath);
|
||||||
|
console.log(`[INFO]: "SimpleSC" unzip finished`);
|
||||||
|
} finally {
|
||||||
|
await fs.remove(tempDir);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main
|
* main
|
||||||
*/
|
*/
|
||||||
@@ -373,6 +397,7 @@ const tasks = [
|
|||||||
getLatestReleaseVersion().then(() => resolveSidecar(clashMeta())),
|
getLatestReleaseVersion().then(() => resolveSidecar(clashMeta())),
|
||||||
retry: 5,
|
retry: 5,
|
||||||
},
|
},
|
||||||
|
{ name: "plugin", func: resolvePlugin, retry: 5, winOnly: true },
|
||||||
{ name: "service", func: resolveService, retry: 5, winOnly: true },
|
{ name: "service", func: resolveService, retry: 5, winOnly: true },
|
||||||
{ name: "install", func: resolveInstall, retry: 5, winOnly: true },
|
{ name: "install", func: resolveInstall, retry: 5, winOnly: true },
|
||||||
{ name: "uninstall", func: resolveUninstall, retry: 5, winOnly: true },
|
{ name: "uninstall", func: resolveUninstall, retry: 5, winOnly: true },
|
||||||
|
|||||||
+15
-4
@@ -5,9 +5,9 @@ import { createRequire } from "module";
|
|||||||
import { getOctokit, context } from "@actions/github";
|
import { getOctokit, context } from "@actions/github";
|
||||||
|
|
||||||
const target = process.argv.slice(2)[0];
|
const target = process.argv.slice(2)[0];
|
||||||
|
const alpha = process.argv.slice(2)[1];
|
||||||
|
|
||||||
const ARCH_MAP = {
|
const ARCH_MAP = {
|
||||||
"i686-pc-windows-msvc": "x86",
|
|
||||||
"x86_64-pc-windows-msvc": "x64",
|
"x86_64-pc-windows-msvc": "x64",
|
||||||
"aarch64-pc-windows-msvc": "arm64",
|
"aarch64-pc-windows-msvc": "arm64",
|
||||||
};
|
};
|
||||||
@@ -53,14 +53,25 @@ async function resolvePortable() {
|
|||||||
|
|
||||||
const options = { owner: context.repo.owner, repo: context.repo.repo };
|
const options = { owner: context.repo.owner, repo: context.repo.repo };
|
||||||
const github = getOctokit(process.env.GITHUB_TOKEN);
|
const github = getOctokit(process.env.GITHUB_TOKEN);
|
||||||
|
const tag = alpha ? "alpha" : process.env.TAG_NAME || `v${version}`;
|
||||||
console.log("[INFO]: upload to ", process.env.TAG_NAME || `v${version}`);
|
console.log("[INFO]: upload to ", tag);
|
||||||
|
|
||||||
const { data: release } = await github.rest.repos.getReleaseByTag({
|
const { data: release } = await github.rest.repos.getReleaseByTag({
|
||||||
...options,
|
...options,
|
||||||
tag: process.env.TAG_NAME || `v${version}`,
|
tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let assets = release.assets.filter((x) => {
|
||||||
|
return x.name === zipFile;
|
||||||
|
});
|
||||||
|
if (assets.length > 0) {
|
||||||
|
let id = assets[0].id;
|
||||||
|
await github.rest.repos.deleteReleaseAsset({
|
||||||
|
...options,
|
||||||
|
asset_id: id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log(release.name);
|
console.log(release.name);
|
||||||
|
|
||||||
await github.rest.repos.uploadReleaseAsset({
|
await github.rest.repos.uploadReleaseAsset({
|
||||||
|
|||||||
@@ -45,11 +45,9 @@ async function resolveUpdater() {
|
|||||||
"darwin-intel": { signature: "", url: "" },
|
"darwin-intel": { signature: "", url: "" },
|
||||||
"darwin-x86_64": { signature: "", url: "" },
|
"darwin-x86_64": { signature: "", url: "" },
|
||||||
"linux-x86_64": { signature: "", url: "" },
|
"linux-x86_64": { signature: "", url: "" },
|
||||||
"linux-i686": { signature: "", url: "" },
|
|
||||||
"linux-aarch64": { signature: "", url: "" },
|
"linux-aarch64": { signature: "", url: "" },
|
||||||
"linux-armv7": { signature: "", url: "" },
|
"linux-armv7": { signature: "", url: "" },
|
||||||
"windows-x86_64": { signature: "", url: "" },
|
"windows-x86_64": { signature: "", url: "" },
|
||||||
"windows-i686": { signature: "", url: "" },
|
|
||||||
"windows-aarch64": { signature: "", url: "" },
|
"windows-aarch64": { signature: "", url: "" },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -69,16 +67,6 @@ async function resolveUpdater() {
|
|||||||
updateData.platforms["windows-x86_64"].signature = sig;
|
updateData.platforms["windows-x86_64"].signature = sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// win32 url
|
|
||||||
if (name.endsWith("x86-setup.nsis.zip")) {
|
|
||||||
updateData.platforms["windows-i686"].url = browser_download_url;
|
|
||||||
}
|
|
||||||
// win32 signature
|
|
||||||
if (name.endsWith("x86-setup.nsis.zip.sig")) {
|
|
||||||
const sig = await getSignature(browser_download_url);
|
|
||||||
updateData.platforms["windows-i686"].signature = sig;
|
|
||||||
}
|
|
||||||
|
|
||||||
// win arm url
|
// win arm url
|
||||||
if (name.endsWith("arm64-setup.nsis.zip")) {
|
if (name.endsWith("arm64-setup.nsis.zip")) {
|
||||||
updateData.platforms["windows-aarch64"].url = browser_download_url;
|
updateData.platforms["windows-aarch64"].url = browser_download_url;
|
||||||
@@ -130,16 +118,6 @@ async function resolveUpdater() {
|
|||||||
updateData.platforms["linux-aarch64"].signature = sig;
|
updateData.platforms["linux-aarch64"].signature = sig;
|
||||||
updateData.platforms["linux-armv7"].signature = sig;
|
updateData.platforms["linux-armv7"].signature = sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// linux x86 url
|
|
||||||
if (name.endsWith("i386.AppImage.tar.gz")) {
|
|
||||||
updateData.platforms["linux-i686"].url = browser_download_url;
|
|
||||||
}
|
|
||||||
// linux x86 signature
|
|
||||||
if (name.endsWith("i386.AppImage.tar.gz.sig")) {
|
|
||||||
const sig = await getSignature(browser_download_url);
|
|
||||||
updateData.platforms["linux-i686"].signature = sig;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.allSettled(promises);
|
await Promise.allSettled(promises);
|
||||||
|
|||||||
Generated
+2
-3
@@ -346,8 +346,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "auto-launch"
|
name = "auto-launch"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/zzzgydi/auto-launch?branch=main#2d94a103ca20652a3baf581ca2c296791c35c09b"
|
||||||
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs 4.0.0",
|
"dirs 4.0.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -599,7 +598,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clash-verge"
|
name = "clash-verge"
|
||||||
version = "1.5.1"
|
version = "1.5.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auto-launch",
|
"auto-launch",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "clash-verge"
|
name = "clash-verge"
|
||||||
version = "1.5.1"
|
version = "1.5.2"
|
||||||
description = "clash verge"
|
description = "clash verge"
|
||||||
authors = ["zzzgydi", "wonfen", "MystiPanda"]
|
authors = ["zzzgydi", "wonfen", "MystiPanda"]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
@@ -28,7 +28,6 @@ sysinfo = "0.30"
|
|||||||
rquickjs = "0.3" # 高版本不支持 Linux aarch64
|
rquickjs = "0.3" # 高版本不支持 Linux aarch64
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
auto-launch = "0.5"
|
|
||||||
once_cell = "1.18"
|
once_cell = "1.18"
|
||||||
port_scanner = "0.1.5"
|
port_scanner = "0.1.5"
|
||||||
delay_timer = "0.11.5"
|
delay_timer = "0.11.5"
|
||||||
@@ -39,6 +38,7 @@ tokio = { version = "1", features = ["full"] }
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
|
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
|
||||||
sysproxy = { git="https://github.com/zzzgydi/sysproxy-rs", branch = "main" }
|
sysproxy = { git="https://github.com/zzzgydi/sysproxy-rs", branch = "main" }
|
||||||
|
auto-launch = { git="https://github.com/zzzgydi/auto-launch", branch = "main" }
|
||||||
tauri = { version = "1.5", features = [ "dialog-open", "notification-all", "icon-png", "clipboard-all", "global-shortcut-all", "process-all", "shell-all", "system-tray", "updater", "window-all"] }
|
tauri = { version = "1.5", features = [ "dialog-open", "notification-all", "icon-png", "clipboard-all", "global-shortcut-all", "process-all", "shell-all", "system-tray", "updater", "window-all"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
|||||||
@@ -249,8 +249,9 @@ pub mod uwp {
|
|||||||
pub async fn clash_api_get_proxy_delay(
|
pub async fn clash_api_get_proxy_delay(
|
||||||
name: String,
|
name: String,
|
||||||
url: Option<String>,
|
url: Option<String>,
|
||||||
|
timeout: i32,
|
||||||
) -> CmdResult<clash_api::DelayRes> {
|
) -> CmdResult<clash_api::DelayRes> {
|
||||||
match clash_api::get_proxy_delay(name, url).await {
|
match clash_api::get_proxy_delay(name, url, timeout).await {
|
||||||
Ok(res) => Ok(res),
|
Ok(res) => Ok(res),
|
||||||
Err(err) => Err(err.to_string()),
|
Err(err) => Err(err.to_string()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,33 @@ pub struct IClashTemp(pub Mapping);
|
|||||||
|
|
||||||
impl IClashTemp {
|
impl IClashTemp {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
let template = Self::template();
|
||||||
match dirs::clash_path().and_then(|path| help::read_merge_mapping(&path)) {
|
match dirs::clash_path().and_then(|path| help::read_merge_mapping(&path)) {
|
||||||
Ok(map) => Self(Self::guard(map)),
|
Ok(mut map) => {
|
||||||
|
template.0.keys().for_each(|key| {
|
||||||
|
if !map.contains_key(key) {
|
||||||
|
map.insert(key.clone(), template.0.get(key).unwrap().clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Self(Self::guard(map))
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!(target: "app", "{err}");
|
log::error!(target: "app", "{err}");
|
||||||
Self::template()
|
template
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn template() -> Self {
|
pub fn template() -> Self {
|
||||||
let mut map = Mapping::new();
|
let mut map = Mapping::new();
|
||||||
|
let mut tun = Mapping::new();
|
||||||
|
tun.insert("stack".into(), "gVisor".into());
|
||||||
|
tun.insert("device".into(), "Meta".into());
|
||||||
|
tun.insert("auto-route".into(), true.into());
|
||||||
|
tun.insert("strict-route".into(), true.into());
|
||||||
|
tun.insert("auto-detect-interface".into(), true.into());
|
||||||
|
tun.insert("dns-hijack".into(), vec!["any:53", "tcp://any:53"].into());
|
||||||
|
tun.insert("mtu".into(), 9000.into());
|
||||||
|
|
||||||
map.insert("mixed-port".into(), 7897.into());
|
map.insert("mixed-port".into(), 7897.into());
|
||||||
map.insert("socks-port".into(), 7898.into());
|
map.insert("socks-port".into(), 7898.into());
|
||||||
@@ -32,6 +48,7 @@ impl IClashTemp {
|
|||||||
map.insert("mode".into(), "rule".into());
|
map.insert("mode".into(), "rule".into());
|
||||||
map.insert("external-controller".into(), "127.0.0.1:9097".into());
|
map.insert("external-controller".into(), "127.0.0.1:9097".into());
|
||||||
map.insert("secret".into(), "".into());
|
map.insert("secret".into(), "".into());
|
||||||
|
map.insert("tun".into(), tun.into());
|
||||||
|
|
||||||
Self(map)
|
Self(map)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
use crate::enhance::field::use_keys;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_yaml::Mapping;
|
use serde_yaml::{Mapping, Value};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct IRuntime {
|
pub struct IRuntime {
|
||||||
pub config: Option<Mapping>,
|
pub config: Option<Mapping>,
|
||||||
@@ -16,7 +16,7 @@ impl IRuntime {
|
|||||||
Self::default()
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 这里只更改 allow-lan | ipv6 | log-level
|
// 这里只更改 allow-lan | ipv6 | log-level | tun
|
||||||
pub fn patch_config(&mut self, patch: Mapping) {
|
pub fn patch_config(&mut self, patch: Mapping) {
|
||||||
if let Some(config) = self.config.as_mut() {
|
if let Some(config) = self.config.as_mut() {
|
||||||
["allow-lan", "ipv6", "log-level"]
|
["allow-lan", "ipv6", "log-level"]
|
||||||
@@ -26,6 +26,20 @@ impl IRuntime {
|
|||||||
config.insert(key.into(), value.clone());
|
config.insert(key.into(), value.clone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let tun = config.get("tun");
|
||||||
|
let mut tun = tun.map_or(Mapping::new(), |val| {
|
||||||
|
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
||||||
|
});
|
||||||
|
let patch_tun = patch.get("tun");
|
||||||
|
let patch_tun = patch_tun.map_or(Mapping::new(), |val| {
|
||||||
|
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
||||||
|
});
|
||||||
|
use_keys(&patch_tun).into_iter().for_each(|key| {
|
||||||
|
if let Some(value) = patch_tun.get(&key).to_owned() {
|
||||||
|
tun.insert(key.into(), value.clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
config.insert("tun".into(), Value::from(tun));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ pub struct IVerge {
|
|||||||
/// 默认的延迟测试连接
|
/// 默认的延迟测试连接
|
||||||
pub default_latency_test: Option<String>,
|
pub default_latency_test: Option<String>,
|
||||||
|
|
||||||
|
/// 默认的延迟测试超时时间
|
||||||
|
pub default_latency_timeout: Option<i32>,
|
||||||
|
|
||||||
/// 是否使用内部的脚本支持,默认为真
|
/// 是否使用内部的脚本支持,默认为真
|
||||||
pub enable_builtin_enhanced: Option<bool>,
|
pub enable_builtin_enhanced: Option<bool>,
|
||||||
|
|
||||||
@@ -222,6 +225,7 @@ impl IVerge {
|
|||||||
|
|
||||||
patch!(auto_close_connection);
|
patch!(auto_close_connection);
|
||||||
patch!(default_latency_test);
|
patch!(default_latency_test);
|
||||||
|
patch!(default_latency_timeout);
|
||||||
patch!(enable_builtin_enhanced);
|
patch!(enable_builtin_enhanced);
|
||||||
patch!(proxy_layout_column);
|
patch!(proxy_layout_column);
|
||||||
patch!(test_list);
|
patch!(test_list);
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ pub struct DelayRes {
|
|||||||
|
|
||||||
/// GET /proxies/{name}/delay
|
/// GET /proxies/{name}/delay
|
||||||
/// 获取代理延迟
|
/// 获取代理延迟
|
||||||
pub async fn get_proxy_delay(name: String, test_url: Option<String>) -> Result<DelayRes> {
|
pub async fn get_proxy_delay(
|
||||||
|
name: String,
|
||||||
|
test_url: Option<String>,
|
||||||
|
timeout: i32,
|
||||||
|
) -> Result<DelayRes> {
|
||||||
let (url, headers) = clash_client_info()?;
|
let (url, headers) = clash_client_info()?;
|
||||||
let url = format!("{url}/proxies/{name}/delay");
|
let url = format!("{url}/proxies/{name}/delay");
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ pub async fn get_proxy_delay(name: String, test_url: Option<String>) -> Result<D
|
|||||||
let builder = client
|
let builder = client
|
||||||
.get(&url)
|
.get(&url)
|
||||||
.headers(headers)
|
.headers(headers)
|
||||||
.query(&[("timeout", "10000"), ("url", &test_url)]);
|
.query(&[("timeout", &format!("{timeout}")), ("url", &test_url)]);
|
||||||
let response = builder.send().await?;
|
let response = builder.send().await?;
|
||||||
|
|
||||||
Ok(response.json::<DelayRes>().await?)
|
Ok(response.json::<DelayRes>().await?)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ pub fn use_merge(merge: Mapping, mut config: Mapping) -> Mapping {
|
|||||||
// 直接覆盖原字段
|
// 直接覆盖原字段
|
||||||
use_lowercase(merge.clone())
|
use_lowercase(merge.clone())
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.filter(|(key, _)| !MERGE_FIELDS.contains(&key.as_str().unwrap_or_default()))
|
||||||
.for_each(|(key, value)| {
|
.for_each(|(key, value)| {
|
||||||
config.insert(key, value);
|
config.insert(key, value);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
mod chain;
|
mod chain;
|
||||||
mod field;
|
pub mod field;
|
||||||
mod merge;
|
mod merge;
|
||||||
mod script;
|
mod script;
|
||||||
mod tun;
|
mod tun;
|
||||||
@@ -78,7 +78,18 @@ pub fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
|||||||
|
|
||||||
// 合并默认的config
|
// 合并默认的config
|
||||||
for (key, value) in clash_config.into_iter() {
|
for (key, value) in clash_config.into_iter() {
|
||||||
config.insert(key, value);
|
if key.as_str() == Some("tun") {
|
||||||
|
let mut tun = config.get_mut("tun").map_or(Mapping::new(), |val| {
|
||||||
|
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
||||||
|
});
|
||||||
|
let patch_tun = value.as_mapping().cloned().unwrap_or(Mapping::new());
|
||||||
|
for (key, value) in patch_tun.into_iter() {
|
||||||
|
tun.insert(key, value);
|
||||||
|
}
|
||||||
|
config.insert("tun".into(), tun.into());
|
||||||
|
} else {
|
||||||
|
config.insert(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 内建脚本最后跑
|
// 内建脚本最后跑
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ pub fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
|||||||
});
|
});
|
||||||
|
|
||||||
revise!(tun_val, "enable", enable);
|
revise!(tun_val, "enable", enable);
|
||||||
if enable {
|
|
||||||
append!(tun_val, "stack", "gvisor");
|
|
||||||
append!(tun_val, "dns-hijack", vec!["any:53"]);
|
|
||||||
append!(tun_val, "auto-route", true);
|
|
||||||
append!(tun_val, "auto-detect-interface", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
revise!(config, "tun", tun_val);
|
revise!(config, "tun", tun_val);
|
||||||
|
|
||||||
|
|||||||
@@ -92,14 +92,9 @@ pub fn clash_pid_path() -> Result<PathBuf> {
|
|||||||
Ok(app_home_dir()?.join("clash.pid"))
|
Ok(app_home_dir()?.join("clash.pid"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
pub fn service_dir() -> Result<PathBuf> {
|
|
||||||
Ok(app_home_dir()?.join("service"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn service_path() -> Result<PathBuf> {
|
pub fn service_path() -> Result<PathBuf> {
|
||||||
Ok(service_dir()?.join("clash-verge-service.exe"))
|
Ok(app_resources_dir()?.join("clash-verge-service.exe"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|||||||
@@ -240,67 +240,6 @@ pub fn init_resources() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// initialize service resources
|
|
||||||
/// after tauri setup
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
pub fn init_service() -> Result<()> {
|
|
||||||
let service_dir = dirs::service_dir()?;
|
|
||||||
let res_dir = dirs::app_resources_dir()?;
|
|
||||||
|
|
||||||
if !service_dir.exists() {
|
|
||||||
let _ = fs::create_dir_all(&service_dir);
|
|
||||||
}
|
|
||||||
if !res_dir.exists() {
|
|
||||||
let _ = fs::create_dir_all(&res_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
let file_list = [
|
|
||||||
"clash-verge-service.exe",
|
|
||||||
"install-service.exe",
|
|
||||||
"uninstall-service.exe",
|
|
||||||
];
|
|
||||||
|
|
||||||
// copy the resource file
|
|
||||||
// if the source file is newer than the destination file, copy it over
|
|
||||||
for file in file_list.iter() {
|
|
||||||
let src_path = res_dir.join(file);
|
|
||||||
let dest_path = service_dir.join(file);
|
|
||||||
|
|
||||||
let handle_copy = || {
|
|
||||||
match fs::copy(&src_path, &dest_path) {
|
|
||||||
Ok(_) => log::debug!(target: "app", "resources copied '{file}'"),
|
|
||||||
Err(err) => {
|
|
||||||
log::error!(target: "app", "failed to copy resources '{file}', {err}")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if src_path.exists() && !dest_path.exists() {
|
|
||||||
handle_copy();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let src_modified = fs::metadata(&src_path).and_then(|m| m.modified());
|
|
||||||
let dest_modified = fs::metadata(&dest_path).and_then(|m| m.modified());
|
|
||||||
|
|
||||||
match (src_modified, dest_modified) {
|
|
||||||
(Ok(src_modified), Ok(dest_modified)) => {
|
|
||||||
if src_modified > dest_modified {
|
|
||||||
handle_copy();
|
|
||||||
} else {
|
|
||||||
log::debug!(target: "app", "skipping resource copy '{file}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
log::debug!(target: "app", "failed to get modified '{file}'");
|
|
||||||
handle_copy();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// initialize url scheme
|
/// initialize url scheme
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub fn init_scheme() -> Result<()> {
|
pub fn init_scheme() -> Result<()> {
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ pub fn resolve_setup(app: &mut App) {
|
|||||||
VERSION.get_or_init(|| version.clone());
|
VERSION.get_or_init(|| version.clone());
|
||||||
|
|
||||||
log_err!(init::init_resources());
|
log_err!(init::init_resources());
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
log_err!(init::init_service());
|
|
||||||
log_err!(init::init_scheme());
|
log_err!(init::init_scheme());
|
||||||
log_err!(init::startup_script());
|
log_err!(init::startup_script());
|
||||||
// 处理随机端口
|
// 处理随机端口
|
||||||
@@ -186,9 +184,9 @@ pub fn create_window(app_handle: &AppHandle) {
|
|||||||
let pos = win.outer_position()?;
|
let pos = win.outer_position()?;
|
||||||
|
|
||||||
if pos.x < -400
|
if pos.x < -400
|
||||||
|| pos.x > (size.width - 200).try_into()?
|
|| pos.x > (size.width - 200) as i32
|
||||||
|| pos.y < -200
|
|| pos.y < -200
|
||||||
|| pos.y > (size.height - 200).try_into()?
|
|| pos.y > (size.height - 200) as i32
|
||||||
{
|
{
|
||||||
center = true;
|
center = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "Clash Verge",
|
"productName": "Clash Verge",
|
||||||
"version": "1.5.1"
|
"version": "1.5.2"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": "../dist",
|
"distDir": "../dist",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Unicode true
|
|||||||
!include WordFunc.nsh
|
!include WordFunc.nsh
|
||||||
!include "LogicLib.nsh"
|
!include "LogicLib.nsh"
|
||||||
!include "StrFunc.nsh"
|
!include "StrFunc.nsh"
|
||||||
|
!addplugindir "$%AppData%\Local\NSIS\"
|
||||||
${StrCase}
|
${StrCase}
|
||||||
${StrLoc}
|
${StrLoc}
|
||||||
|
|
||||||
@@ -423,6 +424,7 @@ FunctionEnd
|
|||||||
nsis_tauri_utils::FindProcess "Clash Verge.exe"
|
nsis_tauri_utils::FindProcess "Clash Verge.exe"
|
||||||
${If} $R0 != 0
|
${If} $R0 != 0
|
||||||
; Kill the process
|
; Kill the process
|
||||||
|
DetailPrint "Kill Clash Verge.exe..."
|
||||||
!if "${INSTALLMODE}" == "currentUser"
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
nsis_tauri_utils::KillProcessCurrentUser "Clash Verge.exe"
|
nsis_tauri_utils::KillProcessCurrentUser "Clash Verge.exe"
|
||||||
!else
|
!else
|
||||||
@@ -435,6 +437,7 @@ FunctionEnd
|
|||||||
nsis_tauri_utils::FindProcess "clash-verge-service.exe"
|
nsis_tauri_utils::FindProcess "clash-verge-service.exe"
|
||||||
${If} $R0 != 0
|
${If} $R0 != 0
|
||||||
; Kill the process
|
; Kill the process
|
||||||
|
DetailPrint "Kill clash-verge-service.exe..."
|
||||||
!if "${INSTALLMODE}" == "currentUser"
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
nsis_tauri_utils::KillProcessCurrentUser "clash-verge-service.exe"
|
nsis_tauri_utils::KillProcessCurrentUser "clash-verge-service.exe"
|
||||||
!else
|
!else
|
||||||
@@ -447,6 +450,7 @@ FunctionEnd
|
|||||||
nsis_tauri_utils::FindProcess "clash-meta-alpha.exe"
|
nsis_tauri_utils::FindProcess "clash-meta-alpha.exe"
|
||||||
${If} $R0 != 0
|
${If} $R0 != 0
|
||||||
; Kill the process
|
; Kill the process
|
||||||
|
DetailPrint "Kill clash-meta-alpha.exe..."
|
||||||
!if "${INSTALLMODE}" == "currentUser"
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
nsis_tauri_utils::KillProcessCurrentUser "clash-meta-alpha.exe"
|
nsis_tauri_utils::KillProcessCurrentUser "clash-meta-alpha.exe"
|
||||||
!else
|
!else
|
||||||
@@ -458,6 +462,7 @@ FunctionEnd
|
|||||||
nsis_tauri_utils::FindProcess "clash-meta.exe"
|
nsis_tauri_utils::FindProcess "clash-meta.exe"
|
||||||
${If} $R0 != 0
|
${If} $R0 != 0
|
||||||
; Kill the process
|
; Kill the process
|
||||||
|
DetailPrint "Kill clash-meta.exe..."
|
||||||
!if "${INSTALLMODE}" == "currentUser"
|
!if "${INSTALLMODE}" == "currentUser"
|
||||||
nsis_tauri_utils::KillProcessCurrentUser "clash-meta.exe"
|
nsis_tauri_utils::KillProcessCurrentUser "clash-meta.exe"
|
||||||
!else
|
!else
|
||||||
@@ -466,9 +471,70 @@ FunctionEnd
|
|||||||
${EndIf}
|
${EndIf}
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
Section
|
!macro StartVergeService
|
||||||
!insertmacro CheckAllVergeProcesses
|
; Check if the service exists
|
||||||
SectionEnd
|
SimpleSC::ExistsService "clash_verge_service"
|
||||||
|
Pop $0 ; 0:service exists;other: service not exists
|
||||||
|
; Service exists
|
||||||
|
${If} $0 == 0
|
||||||
|
Push $0
|
||||||
|
; Check if the service is running
|
||||||
|
SimpleSC::ServiceIsRunning "clash_verge_service"
|
||||||
|
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
|
||||||
|
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
|
||||||
|
${If} $0 == 0
|
||||||
|
Push $0
|
||||||
|
${If} $1 == 0
|
||||||
|
DetailPrint "Restart Clash Verge Service..."
|
||||||
|
SimpleSC::StartService "clash_verge_service" "" 30
|
||||||
|
${EndIf}
|
||||||
|
${ElseIf} $0 != 0
|
||||||
|
Push $0
|
||||||
|
SimpleSC::GetErrorMessage
|
||||||
|
Pop $0
|
||||||
|
MessageBox MB_OK|MB_ICONSTOP "Check Service Status Error ($0)"
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro RemoveVergeService
|
||||||
|
; Check if the service exists
|
||||||
|
SimpleSC::ExistsService "clash_verge_service"
|
||||||
|
Pop $0 ; 0:service exists;other: service not exists
|
||||||
|
; Service exists
|
||||||
|
${If} $0 == 0
|
||||||
|
Push $0
|
||||||
|
; Check if the service is running
|
||||||
|
SimpleSC::ServiceIsRunning "clash_verge_service"
|
||||||
|
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
|
||||||
|
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
|
||||||
|
${If} $0 == 0
|
||||||
|
Push $0
|
||||||
|
${If} $1 == 1
|
||||||
|
DetailPrint "Stop Clash Verge Service..."
|
||||||
|
SimpleSC::StopService "clash_verge_service" 1 30
|
||||||
|
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
|
||||||
|
${If} $0 == 0
|
||||||
|
DetailPrint "Removing Clash Verge Service..."
|
||||||
|
SimpleSC::RemoveService "clash_verge_service"
|
||||||
|
${ElseIf} $0 != 0
|
||||||
|
Push $0
|
||||||
|
SimpleSC::GetErrorMessage
|
||||||
|
Pop $0
|
||||||
|
MessageBox MB_OK|MB_ICONSTOP "Clash Verge Service Stop Error ($0)"
|
||||||
|
${EndIf}
|
||||||
|
${ElseIf} $1 == 0
|
||||||
|
DetailPrint "Removing Clash Verge Service..."
|
||||||
|
SimpleSC::RemoveService "clash_verge_service"
|
||||||
|
${EndIf}
|
||||||
|
${ElseIf} $0 != 0
|
||||||
|
Push $0
|
||||||
|
SimpleSC::GetErrorMessage
|
||||||
|
Pop $0
|
||||||
|
MessageBox MB_OK|MB_ICONSTOP "Check Service Status Error ($0)"
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
Section EarlyChecks
|
Section EarlyChecks
|
||||||
; Abort silent installer if downgrades is disabled
|
; Abort silent installer if downgrades is disabled
|
||||||
@@ -608,6 +674,8 @@ Section Install
|
|||||||
File /a "/oname={{this}}" "{{@key}}"
|
File /a "/oname={{this}}" "{{@key}}"
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
!insertmacro StartVergeService
|
||||||
|
|
||||||
; Create uninstaller
|
; Create uninstaller
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
@@ -679,6 +747,7 @@ FunctionEnd
|
|||||||
Section Uninstall
|
Section Uninstall
|
||||||
!insertmacro CheckIfAppIsRunning
|
!insertmacro CheckIfAppIsRunning
|
||||||
!insertmacro CheckAllVergeProcesses
|
!insertmacro CheckAllVergeProcesses
|
||||||
|
!insertmacro RemoveVergeService
|
||||||
; Delete the app directory and its content from disk
|
; Delete the app directory and its content from disk
|
||||||
; Copy main executable
|
; Copy main executable
|
||||||
Delete "$INSTDIR\${MAINBINARYNAME}.exe"
|
Delete "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const ProxyGroups = (props: Props) => {
|
|||||||
|
|
||||||
const { verge } = useVerge();
|
const { verge } = useVerge();
|
||||||
const { current, patchCurrent } = useProfiles();
|
const { current, patchCurrent } = useProfiles();
|
||||||
|
const timeout = verge?.default_latency_timeout || 10000;
|
||||||
|
|
||||||
const virtuosoRef = useRef<VirtuosoHandle>(null);
|
const virtuosoRef = useRef<VirtuosoHandle>(null);
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ export const ProxyGroups = (props: Props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const names = proxies.filter((p) => !p!.provider).map((p) => p!.name);
|
const names = proxies.filter((p) => !p!.provider).map((p) => p!.name);
|
||||||
await delayManager.checkListDelay(names, groupName);
|
await delayManager.checkListDelay(names, groupName, timeout);
|
||||||
|
|
||||||
onProxies();
|
onProxies();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { CheckCircleOutlineRounded } from "@mui/icons-material";
|
|||||||
import { alpha, Box, ListItemButton, styled, Typography } from "@mui/material";
|
import { alpha, Box, ListItemButton, styled, Typography } from "@mui/material";
|
||||||
import { BaseLoading } from "@/components/base";
|
import { BaseLoading } from "@/components/base";
|
||||||
import delayManager from "@/services/delay";
|
import delayManager from "@/services/delay";
|
||||||
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
groupName: string;
|
groupName: string;
|
||||||
@@ -20,6 +21,8 @@ export const ProxyItemMini = (props: Props) => {
|
|||||||
// -1/<=0 为 不显示
|
// -1/<=0 为 不显示
|
||||||
// -2 为 loading
|
// -2 为 loading
|
||||||
const [delay, setDelay] = useState(-1);
|
const [delay, setDelay] = useState(-1);
|
||||||
|
const { verge } = useVerge();
|
||||||
|
const timeout = verge?.default_latency_timeout || 10000;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
delayManager.setListener(proxy.name, groupName, setDelay);
|
delayManager.setListener(proxy.name, groupName, setDelay);
|
||||||
@@ -36,7 +39,7 @@ export const ProxyItemMini = (props: Props) => {
|
|||||||
|
|
||||||
const onDelay = useLockFn(async () => {
|
const onDelay = useLockFn(async () => {
|
||||||
setDelay(-2);
|
setDelay(-2);
|
||||||
setDelay(await delayManager.checkDelay(proxy.name, groupName));
|
setDelay(await delayManager.checkDelay(proxy.name, groupName, timeout));
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -139,14 +142,14 @@ export const ProxyItemMini = (props: Props) => {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onDelay();
|
onDelay();
|
||||||
}}
|
}}
|
||||||
color={delayManager.formatDelayColor(delay)}
|
color={delayManager.formatDelayColor(delay, timeout)}
|
||||||
sx={({ palette }) =>
|
sx={({ palette }) =>
|
||||||
!proxy.provider
|
!proxy.provider
|
||||||
? { ":hover": { bgcolor: alpha(palette.primary.main, 0.15) } }
|
? { ":hover": { bgcolor: alpha(palette.primary.main, 0.15) } }
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{delayManager.formatDelay(delay)}
|
{delayManager.formatDelay(delay, timeout)}
|
||||||
</Widget>
|
</Widget>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { BaseLoading } from "@/components/base";
|
import { BaseLoading } from "@/components/base";
|
||||||
import delayManager from "@/services/delay";
|
import delayManager from "@/services/delay";
|
||||||
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
groupName: string;
|
groupName: string;
|
||||||
@@ -48,7 +49,8 @@ export const ProxyItem = (props: Props) => {
|
|||||||
// -1/<=0 为 不显示
|
// -1/<=0 为 不显示
|
||||||
// -2 为 loading
|
// -2 为 loading
|
||||||
const [delay, setDelay] = useState(-1);
|
const [delay, setDelay] = useState(-1);
|
||||||
|
const { verge } = useVerge();
|
||||||
|
const timeout = verge?.default_latency_timeout || 10000;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
delayManager.setListener(proxy.name, groupName, setDelay);
|
delayManager.setListener(proxy.name, groupName, setDelay);
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@ export const ProxyItem = (props: Props) => {
|
|||||||
|
|
||||||
const onDelay = useLockFn(async () => {
|
const onDelay = useLockFn(async () => {
|
||||||
setDelay(-2);
|
setDelay(-2);
|
||||||
setDelay(await delayManager.checkDelay(proxy.name, groupName));
|
setDelay(await delayManager.checkDelay(proxy.name, groupName, timeout));
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -149,14 +151,14 @@ export const ProxyItem = (props: Props) => {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onDelay();
|
onDelay();
|
||||||
}}
|
}}
|
||||||
color={delayManager.formatDelayColor(delay)}
|
color={delayManager.formatDelayColor(delay, timeout)}
|
||||||
sx={({ palette }) =>
|
sx={({ palette }) =>
|
||||||
!proxy.provider
|
!proxy.provider
|
||||||
? { ":hover": { bgcolor: alpha(palette.primary.main, 0.15) } }
|
? { ":hover": { bgcolor: alpha(palette.primary.main, 0.15) } }
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{delayManager.formatDelay(delay)}
|
{delayManager.formatDelay(delay, timeout)}
|
||||||
</Widget>
|
</Widget>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type HeadStateStorage = Record<string, Record<string, HeadState>>;
|
|||||||
const HEAD_STATE_KEY = "proxy-head-state";
|
const HEAD_STATE_KEY = "proxy-head-state";
|
||||||
export const DEFAULT_STATE: HeadState = {
|
export const DEFAULT_STATE: HeadState = {
|
||||||
open: false,
|
open: false,
|
||||||
showType: false,
|
showType: true,
|
||||||
sortType: 0,
|
sortType: 0,
|
||||||
filterText: "",
|
filterText: "",
|
||||||
textState: null,
|
textState: null,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
proxyLayoutColumn: 6,
|
proxyLayoutColumn: 6,
|
||||||
defaultLatencyTest: "",
|
defaultLatencyTest: "",
|
||||||
autoLogClean: 0,
|
autoLogClean: 0,
|
||||||
|
defaultLatencyTimeout: 10000,
|
||||||
});
|
});
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
@@ -37,6 +38,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
proxyLayoutColumn: verge?.proxy_layout_column || 6,
|
proxyLayoutColumn: verge?.proxy_layout_column || 6,
|
||||||
defaultLatencyTest: verge?.default_latency_test || "",
|
defaultLatencyTest: verge?.default_latency_test || "",
|
||||||
autoLogClean: verge?.auto_log_clean || 0,
|
autoLogClean: verge?.auto_log_clean || 0,
|
||||||
|
defaultLatencyTimeout: verge?.default_latency_timeout || 10000,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
close: () => setOpen(false),
|
close: () => setOpen(false),
|
||||||
@@ -50,6 +52,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
enable_builtin_enhanced: values.enableBuiltinEnhanced,
|
enable_builtin_enhanced: values.enableBuiltinEnhanced,
|
||||||
proxy_layout_column: values.proxyLayoutColumn,
|
proxy_layout_column: values.proxyLayoutColumn,
|
||||||
default_latency_test: values.defaultLatencyTest,
|
default_latency_test: values.defaultLatencyTest,
|
||||||
|
default_latency_timeout: values.defaultLatencyTimeout,
|
||||||
auto_log_clean: values.autoLogClean as any,
|
auto_log_clean: values.autoLogClean as any,
|
||||||
});
|
});
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
@@ -179,6 +182,27 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Default Latency Timeout")} />
|
||||||
|
<TextField
|
||||||
|
size="small"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
sx={{ width: 250 }}
|
||||||
|
value={values.defaultLatencyTimeout}
|
||||||
|
placeholder="http://1.1.1.1"
|
||||||
|
onChange={(e) =>
|
||||||
|
setValues((v) => ({
|
||||||
|
...v,
|
||||||
|
defaultLatencyTimeout: parseInt(e.target.value),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,192 @@
|
|||||||
|
import { forwardRef, useImperativeHandle, useState } from "react";
|
||||||
|
import { useLockFn } from "ahooks";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import {
|
||||||
|
List,
|
||||||
|
ListItem,
|
||||||
|
ListItemText,
|
||||||
|
MenuItem,
|
||||||
|
Select,
|
||||||
|
Switch,
|
||||||
|
TextField,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useClash } from "@/hooks/use-clash";
|
||||||
|
import { BaseDialog, DialogRef, Notice } from "@/components/base";
|
||||||
|
|
||||||
|
export const TunViewer = forwardRef<DialogRef>((props, ref) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const { clash, mutateClash, patchClash } = useClash();
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const [values, setValues] = useState({
|
||||||
|
stack: "gVisor",
|
||||||
|
device: "Mihomo",
|
||||||
|
autoRoute: true,
|
||||||
|
autoDetectInterface: true,
|
||||||
|
dnsHijack: ["any:53", "tcp://any:53"],
|
||||||
|
strictRoute: true,
|
||||||
|
mtu: 9000,
|
||||||
|
});
|
||||||
|
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
open: () => {
|
||||||
|
setOpen(true);
|
||||||
|
setValues({
|
||||||
|
stack: clash?.tun.stack ?? "gVisor",
|
||||||
|
device: clash?.tun.device ?? "Mihomo",
|
||||||
|
autoRoute: clash?.tun["auto-route"] ?? true,
|
||||||
|
autoDetectInterface: clash?.tun["auto-detect-interface"] ?? true,
|
||||||
|
dnsHijack: clash?.tun["dns-hijack"] ?? ["any:53", "tcp://any:53"],
|
||||||
|
strictRoute: clash?.tun["strict-route"] ?? true,
|
||||||
|
mtu: clash?.tun.mtu ?? 9000,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close: () => setOpen(false),
|
||||||
|
}));
|
||||||
|
|
||||||
|
const onSave = useLockFn(async () => {
|
||||||
|
try {
|
||||||
|
let tun = {
|
||||||
|
stack: values.stack,
|
||||||
|
device: values.device,
|
||||||
|
"auto-route": values.autoRoute,
|
||||||
|
"auto-detect-interface": values.autoDetectInterface,
|
||||||
|
"dns-hijack": values.dnsHijack,
|
||||||
|
"strict-route": values.strictRoute,
|
||||||
|
mtu: values.mtu,
|
||||||
|
};
|
||||||
|
await patchClash({ tun });
|
||||||
|
await mutateClash(
|
||||||
|
(old) => ({
|
||||||
|
...(old! || {}),
|
||||||
|
tun,
|
||||||
|
}),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
setOpen(false);
|
||||||
|
} catch (err: any) {
|
||||||
|
Notice.error(err.message || err.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseDialog
|
||||||
|
open={open}
|
||||||
|
title={t("Tun Mode")}
|
||||||
|
contentSx={{ width: 450 }}
|
||||||
|
okBtn={t("Save")}
|
||||||
|
cancelBtn={t("Cancel")}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
onOk={onSave}
|
||||||
|
>
|
||||||
|
<List>
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Stack")} />
|
||||||
|
<Select
|
||||||
|
size="small"
|
||||||
|
sx={{ width: 100, "> div": { py: "7.5px" } }}
|
||||||
|
value={values.stack}
|
||||||
|
onChange={(e) => {
|
||||||
|
setValues((v) => ({
|
||||||
|
...v,
|
||||||
|
stack: e.target.value as string,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{["System", "gVisor", "Mixed"].map((i) => (
|
||||||
|
<MenuItem value={i} key={i}>
|
||||||
|
{i}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Device")} />
|
||||||
|
<TextField
|
||||||
|
size="small"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
sx={{ width: 250 }}
|
||||||
|
value={values.device}
|
||||||
|
placeholder="Mihomo"
|
||||||
|
onChange={(e) =>
|
||||||
|
setValues((v) => ({ ...v, device: e.target.value }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Auto Route")} />
|
||||||
|
<Switch
|
||||||
|
edge="end"
|
||||||
|
checked={values.autoRoute}
|
||||||
|
onChange={(_, c) => setValues((v) => ({ ...v, autoRoute: c }))}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Strict Route")} />
|
||||||
|
<Switch
|
||||||
|
edge="end"
|
||||||
|
checked={values.strictRoute}
|
||||||
|
onChange={(_, c) => setValues((v) => ({ ...v, strictRoute: c }))}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Auto Detect Interface")} />
|
||||||
|
<Switch
|
||||||
|
edge="end"
|
||||||
|
checked={values.autoDetectInterface}
|
||||||
|
onChange={(_, c) =>
|
||||||
|
setValues((v) => ({ ...v, autoDetectInterface: c }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("DNS Hijack")} />
|
||||||
|
<TextField
|
||||||
|
size="small"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
sx={{ width: 250 }}
|
||||||
|
value={values.dnsHijack.join(",")}
|
||||||
|
placeholder="Please use , to separate multiple DNS servers"
|
||||||
|
onChange={(e) =>
|
||||||
|
setValues((v) => ({ ...v, dnsHijack: e.target.value.split(",") }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("MTU")} />
|
||||||
|
<TextField
|
||||||
|
size="small"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
sx={{ width: 250 }}
|
||||||
|
value={values.mtu}
|
||||||
|
placeholder="9000"
|
||||||
|
onChange={(e) =>
|
||||||
|
setValues((v) => ({
|
||||||
|
...v,
|
||||||
|
mtu: parseInt(e.target.value),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
</BaseDialog>
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -41,7 +41,6 @@ const SettingClash = ({ onError }: Props) => {
|
|||||||
const { enable_random_port = false, verge_mixed_port } = verge ?? {};
|
const { enable_random_port = false, verge_mixed_port } = verge ?? {};
|
||||||
|
|
||||||
const webRef = useRef<DialogRef>(null);
|
const webRef = useRef<DialogRef>(null);
|
||||||
const fieldRef = useRef<DialogRef>(null);
|
|
||||||
const portRef = useRef<DialogRef>(null);
|
const portRef = useRef<DialogRef>(null);
|
||||||
const ctrlRef = useRef<DialogRef>(null);
|
const ctrlRef = useRef<DialogRef>(null);
|
||||||
const coreRef = useRef<DialogRef>(null);
|
const coreRef = useRef<DialogRef>(null);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { IconButton, Switch } from "@mui/material";
|
import { IconButton, Switch, Tooltip } from "@mui/material";
|
||||||
import { ArrowForward, PrivacyTipRounded, Settings } from "@mui/icons-material";
|
import { PrivacyTipRounded, Settings, InfoRounded } from "@mui/icons-material";
|
||||||
import { checkService } from "@/services/cmds";
|
import { checkService } from "@/services/cmds";
|
||||||
import { useVerge } from "@/hooks/use-verge";
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
import { DialogRef } from "@/components/base";
|
import { DialogRef } from "@/components/base";
|
||||||
@@ -10,6 +10,7 @@ import { SettingList, SettingItem } from "./mods/setting-comp";
|
|||||||
import { GuardState } from "./mods/guard-state";
|
import { GuardState } from "./mods/guard-state";
|
||||||
import { ServiceViewer } from "./mods/service-viewer";
|
import { ServiceViewer } from "./mods/service-viewer";
|
||||||
import { SysproxyViewer } from "./mods/sysproxy-viewer";
|
import { SysproxyViewer } from "./mods/sysproxy-viewer";
|
||||||
|
import { TunViewer } from "./mods/tun-viewer";
|
||||||
import getSystem from "@/utils/get-system";
|
import getSystem from "@/utils/get-system";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -36,6 +37,7 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
|
|
||||||
const serviceRef = useRef<DialogRef>(null);
|
const serviceRef = useRef<DialogRef>(null);
|
||||||
const sysproxyRef = useRef<DialogRef>(null);
|
const sysproxyRef = useRef<DialogRef>(null);
|
||||||
|
const tunRef = useRef<DialogRef>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
enable_tun_mode,
|
enable_tun_mode,
|
||||||
@@ -53,11 +55,41 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<SettingList title={t("System Setting")}>
|
<SettingList title={t("System Setting")}>
|
||||||
<SysproxyViewer ref={sysproxyRef} />
|
<SysproxyViewer ref={sysproxyRef} />
|
||||||
|
<TunViewer ref={tunRef} />
|
||||||
{isWIN && (
|
{isWIN && (
|
||||||
<ServiceViewer ref={serviceRef} enable={!!enable_service_mode} />
|
<ServiceViewer ref={serviceRef} enable={!!enable_service_mode} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<SettingItem label={t("Tun Mode")}>
|
<SettingItem
|
||||||
|
label={t("Tun Mode")}
|
||||||
|
extra={
|
||||||
|
<>
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
isWIN ? t("Tun Mode Info Windows") : t("Tun Mode Info Unix")
|
||||||
|
}
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<IconButton color="inherit" size="small">
|
||||||
|
<InfoRounded
|
||||||
|
fontSize="inherit"
|
||||||
|
style={{ cursor: "pointer", opacity: 0.75 }}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
size="small"
|
||||||
|
onClick={() => tunRef.current?.open()}
|
||||||
|
>
|
||||||
|
<Settings
|
||||||
|
fontSize="inherit"
|
||||||
|
style={{ cursor: "pointer", opacity: 0.75 }}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
<GuardState
|
<GuardState
|
||||||
value={enable_tun_mode ?? false}
|
value={enable_tun_mode ?? false}
|
||||||
valueProps="checked"
|
valueProps="checked"
|
||||||
|
|||||||
+4
-1
@@ -152,6 +152,7 @@
|
|||||||
"Enable Builtin Enhanced": "Enable Builtin Enhanced",
|
"Enable Builtin Enhanced": "Enable Builtin Enhanced",
|
||||||
"Proxy Layout Column": "Proxy Layout Column",
|
"Proxy Layout Column": "Proxy Layout Column",
|
||||||
"Default Latency Test": "Default Latency Test",
|
"Default Latency Test": "Default Latency Test",
|
||||||
|
"Defaule Latency Timeout": "Defaule Latency Timeout",
|
||||||
|
|
||||||
"Auto Log Clean": "Auto Log Clean",
|
"Auto Log Clean": "Auto Log Clean",
|
||||||
"Never Clean": "Never Clean",
|
"Never Clean": "Never Clean",
|
||||||
@@ -159,5 +160,7 @@
|
|||||||
"Retain 30 Days": "Retain 30 Days",
|
"Retain 30 Days": "Retain 30 Days",
|
||||||
"Retain 90 Days": "Retain 90 Days",
|
"Retain 90 Days": "Retain 90 Days",
|
||||||
|
|
||||||
"Portable Updater Error": "The portable version does not support in-app updates. Please manually download and replace it"
|
"Portable Updater Error": "The portable version does not support in-app updates. Please manually download and replace it",
|
||||||
|
"Tun Mode Info Windows": "The Tun mode requires granting core-related permissions. Please enable service mode before using it",
|
||||||
|
"Tun Mode Info Unix": "The Tun mode requires granting core-related permissions. Before using it, please authorize the core in the core settings"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -152,6 +152,7 @@
|
|||||||
"Enable Builtin Enhanced": "开启内建增强功能",
|
"Enable Builtin Enhanced": "开启内建增强功能",
|
||||||
"Proxy Layout Column": "代理页布局列数",
|
"Proxy Layout Column": "代理页布局列数",
|
||||||
"Default Latency Test": "默认测试链接",
|
"Default Latency Test": "默认测试链接",
|
||||||
|
"Default Latency Timeout": "测试超时时间",
|
||||||
|
|
||||||
"Auto Log Clean": "自动清理日志",
|
"Auto Log Clean": "自动清理日志",
|
||||||
"Never Clean": "不清理",
|
"Never Clean": "不清理",
|
||||||
@@ -159,5 +160,7 @@
|
|||||||
"Retain 30 Days": "保留30天",
|
"Retain 30 Days": "保留30天",
|
||||||
"Retain 90 Days": "保留90天",
|
"Retain 90 Days": "保留90天",
|
||||||
|
|
||||||
"Portable Updater Error": "便携版不支持应用内更新,请手动下载替换"
|
"Portable Updater Error": "便携版不支持应用内更新,请手动下载替换",
|
||||||
|
"Tun Mode Info Windows": "Tun模式需要授予内核相关权限,使用前请先开启服务模式",
|
||||||
|
"Tun Mode Info Unix": "Tun模式需要授予内核相关权限,使用前请先在内核设置中给内核授权"
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -160,9 +160,17 @@ export async function openWebUrl(url: string) {
|
|||||||
return invoke<void>("open_web_url", { url });
|
return invoke<void>("open_web_url", { url });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cmdGetProxyDelay(name: string, url?: string) {
|
export async function cmdGetProxyDelay(
|
||||||
|
name: string,
|
||||||
|
timeout: number,
|
||||||
|
url?: string
|
||||||
|
) {
|
||||||
name = encodeURIComponent(name);
|
name = encodeURIComponent(name);
|
||||||
return invoke<{ delay: number }>("clash_api_get_proxy_delay", { name, url });
|
return invoke<{ delay: number }>("clash_api_get_proxy_delay", {
|
||||||
|
name,
|
||||||
|
url,
|
||||||
|
timeout,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cmdTestDelay(url: string) {
|
export async function cmdTestDelay(url: string) {
|
||||||
|
|||||||
+13
-8
@@ -69,12 +69,12 @@ class DelayManager {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkDelay(name: string, group: string) {
|
async checkDelay(name: string, group: string, timeout: number) {
|
||||||
let delay = -1;
|
let delay = -1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = this.getUrl(group);
|
const url = this.getUrl(group);
|
||||||
const result = await cmdGetProxyDelay(name, url);
|
const result = await cmdGetProxyDelay(name, timeout, url);
|
||||||
delay = result.delay;
|
delay = result.delay;
|
||||||
} catch {
|
} catch {
|
||||||
delay = 1e6; // error
|
delay = 1e6; // error
|
||||||
@@ -84,7 +84,12 @@ class DelayManager {
|
|||||||
return delay;
|
return delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkListDelay(nameList: string[], group: string, concurrency = 36) {
|
async checkListDelay(
|
||||||
|
nameList: string[],
|
||||||
|
group: string,
|
||||||
|
timeout: number,
|
||||||
|
concurrency = 36
|
||||||
|
) {
|
||||||
const names = nameList.filter(Boolean);
|
const names = nameList.filter(Boolean);
|
||||||
// 设置正在延迟测试中
|
// 设置正在延迟测试中
|
||||||
names.forEach((name) => this.setDelay(name, group, -2));
|
names.forEach((name) => this.setDelay(name, group, -2));
|
||||||
@@ -98,7 +103,7 @@ class DelayManager {
|
|||||||
const task = names.shift();
|
const task = names.shift();
|
||||||
if (!task) return;
|
if (!task) return;
|
||||||
current += 1;
|
current += 1;
|
||||||
await this.checkDelay(task, group);
|
await this.checkDelay(task, group, timeout);
|
||||||
current -= 1;
|
current -= 1;
|
||||||
total -= 1;
|
total -= 1;
|
||||||
if (total <= 0) resolve(null);
|
if (total <= 0) resolve(null);
|
||||||
@@ -108,15 +113,15 @@ class DelayManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDelay(delay: number) {
|
formatDelay(delay: number, timeout = 10000) {
|
||||||
if (delay <= 0) return "Error";
|
if (delay <= 0) return "Error";
|
||||||
if (delay > 1e5) return "Error";
|
if (delay > 1e5) return "Error";
|
||||||
if (delay >= 10000) return "Timeout"; // 10s
|
if (delay >= timeout) return "Timeout"; // 10s
|
||||||
return `${delay}`;
|
return `${delay}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDelayColor(delay: number) {
|
formatDelayColor(delay: number, timeout = 10000) {
|
||||||
if (delay >= 10000) return "error.main";
|
if (delay >= timeout) return "error.main";
|
||||||
if (delay <= 0) return "error.main";
|
if (delay <= 0) return "error.main";
|
||||||
if (delay > 500) return "warning.main";
|
if (delay > 500) return "warning.main";
|
||||||
return "success.main";
|
return "success.main";
|
||||||
|
|||||||
Vendored
+10
@@ -32,6 +32,15 @@ interface IConfigData {
|
|||||||
"tproxy-port": number;
|
"tproxy-port": number;
|
||||||
"external-controller": string;
|
"external-controller": string;
|
||||||
secret: string;
|
secret: string;
|
||||||
|
tun: {
|
||||||
|
stack: string;
|
||||||
|
device: string;
|
||||||
|
"auto-route": boolean;
|
||||||
|
"auto-detect-interface": boolean;
|
||||||
|
"dns-hijack": string[];
|
||||||
|
"strict-route": boolean;
|
||||||
|
mtu: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IRuleItem {
|
interface IRuleItem {
|
||||||
@@ -219,6 +228,7 @@ interface IVergeConfig {
|
|||||||
};
|
};
|
||||||
auto_close_connection?: boolean;
|
auto_close_connection?: boolean;
|
||||||
default_latency_test?: string;
|
default_latency_test?: string;
|
||||||
|
default_latency_timeout?: number;
|
||||||
enable_builtin_enhanced?: boolean;
|
enable_builtin_enhanced?: boolean;
|
||||||
auto_log_clean?: 0 | 1 | 2 | 3;
|
auto_log_clean?: 0 | 1 | 2 | 3;
|
||||||
proxy_layout_column?: number;
|
proxy_layout_column?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user