Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3c3407c1f | ||
|
|
db7fd8a3d3 | ||
|
|
2b74606764 | ||
|
|
da2000c1e5 | ||
|
|
ab276045ea | ||
|
|
75aee23241 | ||
|
|
3a59d95732 | ||
|
|
6916009cc7 | ||
|
|
9b82d02c67 | ||
|
|
099cf8065f | ||
|
|
ad8b5a5171 | ||
|
|
ac09de615e | ||
|
|
743cc42879 | ||
|
|
3fd969b9b0 | ||
|
|
92ba69078d | ||
|
|
20ca8619f7 | ||
|
|
892738e198 | ||
|
|
1aa0c7bc34 | ||
|
|
aba9715453 | ||
|
|
c8f61d6359 | ||
|
|
1fd018f3f8 | ||
|
|
d7cfd7d3ac | ||
|
|
e310381735 | ||
|
|
8b5385b701 | ||
|
|
a1e1fedc3f | ||
|
|
84dc631d80 | ||
|
|
6a3072fe04 | ||
|
|
98d943f39d | ||
|
|
bcf724273d | ||
|
|
8703918a8c | ||
|
|
7e88f3ba29 |
24
.github/workflows/autobuild.yml
vendored
24
.github/workflows/autobuild.yml
vendored
@@ -190,7 +190,7 @@ jobs:
|
||||
target: aarch64-apple-darwin
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
save-if: ${{ github.ref == 'refs/heads/dev' }}
|
||||
|
||||
- name: Install dependencies (ubuntu only)
|
||||
if: matrix.os == 'ubuntu-22.04'
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libxslt1.1 libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
||||
@@ -261,10 +261,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
arch: arm64
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-latest
|
||||
target: armv7-unknown-linux-gnueabihf
|
||||
arch: armhf
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -309,15 +309,15 @@ jobs:
|
||||
sudo ls -lR /etc/apt/
|
||||
|
||||
cat > /tmp/sources.list << EOF
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu noble main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu noble-security main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu noble-updates main multiverse universe restricted
|
||||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu noble-backports main multiverse universe restricted
|
||||
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-security main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates main multiverse universe restricted
|
||||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-backports main multiverse universe restricted
|
||||
EOF
|
||||
|
||||
sudo mv /etc/apt/sources.list /etc/apt/sources.list.default
|
||||
|
||||
73
.github/workflows/release.yml
vendored
73
.github/workflows/release.yml
vendored
@@ -6,8 +6,8 @@ on:
|
||||
# workflow_dispatch:
|
||||
push:
|
||||
# 应当限制在 main 分支上触发发布。
|
||||
branches:
|
||||
- main
|
||||
# branches:
|
||||
# - main
|
||||
# 应当限制 v*.*.* 的 tag 触发发布。
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
@@ -86,29 +86,33 @@ jobs:
|
||||
## Which version should I download?
|
||||
|
||||
### macOS
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_aarch64.dmg"><img src="https://img.shields.io/badge/DMG-default?style=flat&logo=apple&label=Apple%20Silicon"></a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_aarch64.dmg"><img src="https://img.shields.io/badge/DMG-default?style=flat&logo=apple&label=Apple%20Silicon"></a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_x64.dmg"><img src="https://img.shields.io/badge/DMG-default?style=flat&logo=apple&label=Intel"></a><br>
|
||||
> :warning: **Warning**
|
||||
If you get a notification that the application is corrupted when you run it on macOS, run this command:<br>
|
||||
<code>sudo xattr -r -c /Applications/Koala\ Clash.app</code>
|
||||
|
||||
### Linux
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_amd64.deb"><img src="https://img.shields.io/badge/x64-default?style=flat&logo=debian&label=DEB"> </a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_amd64.deb"><img src="https://img.shields.io/badge/x64-default?style=flat&logo=debian&label=DEB"> </a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash.x86_64.rpm"><img src="https://img.shields.io/badge/x64-default?style=flat&logo=fedora&label=RPM"> </a>
|
||||
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_arm64.deb"><img src="https://img.shields.io/badge/arm64-default?style=flat&logo=debian&label=DEB"> </a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_arm64.deb"><img src="https://img.shields.io/badge/arm64-default?style=flat&logo=debian&label=DEB"> </a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash.aarch64.rpm"><img src="https://img.shields.io/badge/aarch64-default?style=flat&logo=fedora&label=RPM"> </a>
|
||||
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_armhf.deb"><img src="https://img.shields.io/badge/armhf-default?style=flat&logo=debian&label=DEB"> </a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_armhf.deb"><img src="https://img.shields.io/badge/armhf-default?style=flat&logo=debian&label=DEB"> </a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash.armhfp.rpm"><img src="https://img.shields.io/badge/armhfp-default?style=flat&logo=fedora&label=RPM"> </a>
|
||||
|
||||
#### Package availability for many distributions
|
||||
|
||||
<a href="https://aur.archlinux.org/packages/koala-clash-bin"><img src="https://img.shields.io/aur/version/koala-clash-bin"></a>
|
||||
|
||||
### Windows (Win7 is no longer supported)
|
||||
#### Normal version (recommended)
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_x64-setup.exe"><img src="https://badgen.net/badge/icon/x64?icon=windows&label=exe"></a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_x64-setup.exe"><img src="https://badgen.net/badge/icon/x64?icon=windows&label=exe"></a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_arm64-setup.exe"><img src="https://badgen.net/badge/icon/arm64?icon=windows&label=exe"></a>
|
||||
#### Portable version is no longer available with many problems
|
||||
#### Built-in Webview version 2 (large size, only used in enterprise version of the system or can not install webview2)
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_x64_fixed_webview2-setup.exe"><img src="https://badgen.net/badge/icon/x64?icon=windows&label=exe"></a><br>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_x64_fixed_webview2-setup.exe"><img src="https://badgen.net/badge/icon/x64?icon=windows&label=exe"></a>
|
||||
<a href="https://github.com/coolcoala/clash-verge-rev-lite/releases/download/v${{ env.VERSION }}/Koala.Clash_arm64_fixed_webview2-setup.exe"><img src="https://badgen.net/badge/icon/arm64?icon=windows&label=exe"></a>
|
||||
|
||||
Created at ${{ env.BUILDTIME }}.
|
||||
@@ -205,11 +209,19 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Rename .exe files
|
||||
$files = Get-ChildItem ".\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*-setup.exe"
|
||||
foreach ($file in $files) {
|
||||
$newName = $file.Name -replace "_${{steps.build.outputs.appVersion}}_", "_"
|
||||
Rename-Item $file.FullName $newName
|
||||
}
|
||||
|
||||
# Rename .exe.sig files
|
||||
$sigFiles = Get-ChildItem ".\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*-setup.exe.sig"
|
||||
foreach ($file in $sigFiles) {
|
||||
$newName = $file.Name -replace "_${{steps.build.outputs.appVersion}}_", "_"
|
||||
Rename-Item $file.FullName $newName
|
||||
}
|
||||
|
||||
- name: Rename Artifact (Linux/macOS)
|
||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
||||
@@ -235,6 +247,51 @@ jobs:
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Rename macOS Updater Files with Architecture Prefix
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash
|
||||
run: |
|
||||
MACOS_DIR="src-tauri/target/${{ matrix.target }}/release/bundle/macos"
|
||||
|
||||
if [ ! -d "$MACOS_DIR" ]; then
|
||||
echo "macOS bundle directory not found, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Determine architecture suffix
|
||||
if [ "${{ matrix.target }}" == "aarch64-apple-darwin" ]; then
|
||||
ARCH_SUFFIX="_aarch64"
|
||||
elif [ "${{ matrix.target }}" == "x86_64-apple-darwin" ]; then
|
||||
ARCH_SUFFIX="_x64"
|
||||
else
|
||||
echo "Unknown target: ${{ matrix.target }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Rename .app.tar.gz files
|
||||
find "$MACOS_DIR" -type f -name "*.app.tar.gz" ! -name "*.app.tar.gz.sig" -print0 | while IFS= read -r -d '' old_path; do
|
||||
dir_path=$(dirname "$old_path")
|
||||
old_filename=$(basename "$old_path")
|
||||
new_filename=$(echo "$old_filename" | sed -E "s/\.app\.tar\.gz$/${ARCH_SUFFIX}.app.tar.gz/")
|
||||
new_path="${dir_path}/${new_filename}"
|
||||
if [ "$old_path" != "$new_path" ]; then
|
||||
echo "Renaming updater: '$old_filename' -> '$new_filename'"
|
||||
mv "$old_path" "$new_path"
|
||||
fi
|
||||
done
|
||||
|
||||
# Rename .app.tar.gz.sig files
|
||||
find "$MACOS_DIR" -type f -name "*.app.tar.gz.sig" -print0 | while IFS= read -r -d '' old_path; do
|
||||
dir_path=$(dirname "$old_path")
|
||||
old_filename=$(basename "$old_path")
|
||||
new_filename=$(echo "$old_filename" | sed -E "s/\.app\.tar\.gz\.sig$/${ARCH_SUFFIX}.app.tar.gz.sig/")
|
||||
new_path="${dir_path}/${new_filename}"
|
||||
if [ "$old_path" != "$new_path" ]; then
|
||||
echo "Renaming signature: '$old_filename' -> '$new_filename'"
|
||||
mv "$old_path" "$new_path"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Upload Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
|
||||
@@ -9,11 +9,7 @@
|
||||
A Clash Meta GUI based on <a href="https://github.com/tauri-apps/tauri">Tauri</a>.
|
||||
</h3>
|
||||
|
||||
## Preview
|
||||
|
||||
| Dark | Light |
|
||||
| ----------------------------------- | ------------------------------------ |
|
||||
|  |  |
|
||||

|
||||
|
||||
## Install
|
||||
|
||||
|
||||
15
UPDATELOG.md
15
UPDATELOG.md
@@ -1,3 +1,18 @@
|
||||
## v0.2.8
|
||||
- fixed issue with error 0xc00000142 when shutting down the computer
|
||||
- dark mode issue fixed
|
||||
- improved HWID definition
|
||||
- fixed an issue with opening a window via a shortcut when the application is already running
|
||||
- fixed uploading updater for macos
|
||||
- menu removed by right-clicking
|
||||
- allowed to set an empty password on an external controller
|
||||
|
||||
## v0.2.7
|
||||
- fixed bug in proxy groups menu
|
||||
- added message about global mode enabled on main screen
|
||||
- fixed minor bugs
|
||||
- updated Mihomo core to v1.19.14
|
||||
|
||||
## v0.2.6
|
||||
|
||||
- fixed deep links
|
||||
|
||||
BIN
docs/preview.png
Normal file
BIN
docs/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 954 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 712 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 671 KiB |
102
package.json
102
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "koala-clash",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.8",
|
||||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev",
|
||||
@@ -29,55 +29,55 @@
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.0",
|
||||
"@hookform/resolvers": "^5.1.1",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@hookform/resolvers": "^5.2.2",
|
||||
"@juggle/resize-observer": "^3.4.0",
|
||||
"@mui/icons-material": "^7.1.1",
|
||||
"@mui/icons-material": "^7.3.2",
|
||||
"@mui/lab": "7.0.0-beta.13",
|
||||
"@mui/material": "^7.1.1",
|
||||
"@mui/x-data-grid": "^8.5.1",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.14",
|
||||
"@radix-ui/react-context-menu": "^2.2.15",
|
||||
"@radix-ui/react-dialog": "^1.1.14",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
||||
"@mui/material": "^7.3.2",
|
||||
"@mui/x-data-grid": "^8.11.3",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||
"@radix-ui/react-context-menu": "^2.2.16",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
"@radix-ui/react-icons": "^1.3.2",
|
||||
"@radix-ui/react-label": "^2.1.7",
|
||||
"@radix-ui/react-popover": "^1.1.14",
|
||||
"@radix-ui/react-popover": "^1.1.15",
|
||||
"@radix-ui/react-progress": "^1.1.7",
|
||||
"@radix-ui/react-select": "^2.2.5",
|
||||
"@radix-ui/react-select": "^2.2.6",
|
||||
"@radix-ui/react-separator": "^1.1.7",
|
||||
"@radix-ui/react-slot": "^1.2.3",
|
||||
"@radix-ui/react-switch": "^1.2.5",
|
||||
"@radix-ui/react-tooltip": "^1.2.7",
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"@radix-ui/react-switch": "^1.2.6",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@tailwindcss/vite": "^4.1.13",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tauri-apps/api": "2.5.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.2.2",
|
||||
"@tauri-apps/plugin-deep-link": "~2",
|
||||
"@tauri-apps/plugin-dialog": "^2.2.2",
|
||||
"@tauri-apps/plugin-fs": "^2.3.0",
|
||||
"@tauri-apps/plugin-global-shortcut": "^2.2.1",
|
||||
"@tauri-apps/plugin-notification": "^2.2.2",
|
||||
"@tauri-apps/plugin-process": "^2.2.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.3.0",
|
||||
"@tauri-apps/plugin-deep-link": "~2.4.3",
|
||||
"@tauri-apps/plugin-dialog": "^2.4.0",
|
||||
"@tauri-apps/plugin-fs": "^2.4.2",
|
||||
"@tauri-apps/plugin-global-shortcut": "^2.3.0",
|
||||
"@tauri-apps/plugin-notification": "^2.3.1",
|
||||
"@tauri-apps/plugin-process": "^2.3.0",
|
||||
"@tauri-apps/plugin-shell": "2.2.1",
|
||||
"@tauri-apps/plugin-updater": "2.7.1",
|
||||
"@tauri-apps/plugin-window-state": "^2.2.2",
|
||||
"@tauri-apps/plugin-window-state": "^2.4.0",
|
||||
"@types/d3-shape": "^3.1.7",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"ahooks": "^3.8.5",
|
||||
"axios": "^1.9.0",
|
||||
"chart.js": "^4.4.9",
|
||||
"ahooks": "^3.9.5",
|
||||
"axios": "^1.12.2",
|
||||
"chart.js": "^4.5.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"cli-color": "^2.0.4",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
"d3-shape": "^3.2.0",
|
||||
"dayjs": "1.11.13",
|
||||
"foxact": "^0.2.45",
|
||||
"framer-motion": "^12.23.12",
|
||||
"glob": "^11.0.2",
|
||||
"i18next": "^25.2.1",
|
||||
"js-base64": "^3.7.7",
|
||||
"foxact": "^0.2.49",
|
||||
"framer-motion": "^12.23.16",
|
||||
"glob": "^11.0.3",
|
||||
"i18next": "^25.5.2",
|
||||
"js-base64": "^3.7.8",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"lucide-react": "^0.514.0",
|
||||
@@ -85,26 +85,26 @@
|
||||
"monaco-yaml": "^5.4.0",
|
||||
"nanoid": "^5.1.5",
|
||||
"next-themes": "^0.4.6",
|
||||
"peggy": "^5.0.3",
|
||||
"peggy": "^5.0.6",
|
||||
"react": "19.1.0",
|
||||
"react-chartjs-2": "^5.3.0",
|
||||
"react-colorful": "^5.6.1",
|
||||
"react-dom": "19.1.0",
|
||||
"react-error-boundary": "6.0.0",
|
||||
"react-hook-form": "^7.57.0",
|
||||
"react-hook-form": "^7.63.0",
|
||||
"react-i18next": "15.5.2",
|
||||
"react-markdown": "10.1.0",
|
||||
"react-monaco-editor": "0.58.0",
|
||||
"react-router-dom": "7.6.2",
|
||||
"react-virtuoso": "^4.12.8",
|
||||
"react-virtuoso": "^4.14.0",
|
||||
"sockette": "^2.0.6",
|
||||
"sonner": "^2.0.5",
|
||||
"swr": "^2.3.3",
|
||||
"sonner": "^2.0.7",
|
||||
"swr": "^2.3.6",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tar": "^7.4.3",
|
||||
"types-pac": "^1.0.3",
|
||||
"zod": "^3.25.67",
|
||||
"zustand": "^5.0.5"
|
||||
"zod": "^3.25.76",
|
||||
"zustand": "^5.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/github": "^6.0.1",
|
||||
@@ -112,30 +112,30 @@
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/node": "^24.5.2",
|
||||
"@types/react": "19.1.6",
|
||||
"@types/react-dom": "19.1.6",
|
||||
"@vitejs/plugin-legacy": "^6.1.1",
|
||||
"@vitejs/plugin-react": "4.5.1",
|
||||
"adm-zip": "^0.5.16",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"commander": "^14.0.0",
|
||||
"commander": "^14.0.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"husky": "^9.1.7",
|
||||
"meta-json-schema": "^1.19.10",
|
||||
"meta-json-schema": "^1.19.13",
|
||||
"node-fetch": "^3.3.2",
|
||||
"postcss": "^8.5.4",
|
||||
"prettier": "^3.5.3",
|
||||
"postcss": "^8.5.6",
|
||||
"prettier": "^3.6.2",
|
||||
"pretty-quick": "^4.2.2",
|
||||
"sass": "^1.89.1",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"terser": "^5.41.0",
|
||||
"tw-animate-css": "^1.3.4",
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "^6.3.5",
|
||||
"sass": "^1.93.0",
|
||||
"tailwindcss": "^4.1.13",
|
||||
"terser": "^5.44.0",
|
||||
"tw-animate-css": "^1.3.8",
|
||||
"typescript": "^5.9.2",
|
||||
"vite": "^6.3.6",
|
||||
"vite-plugin-monaco-editor": "^1.1.0",
|
||||
"vite-plugin-svgr": "^4.3.0"
|
||||
"vite-plugin-svgr": "^4.5.0"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
@@ -145,4 +145,4 @@
|
||||
},
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@9.13.2"
|
||||
}
|
||||
}
|
||||
2657
pnpm-lock.yaml
generated
2657
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -103,8 +103,8 @@ async function getLatestAlphaVersion() {
|
||||
|
||||
/* ======= clash meta stable ======= */
|
||||
const META_VERSION_URL =
|
||||
"https://github.com/MetaCubeX/mihomo/releases/latest/download/version.txt";
|
||||
const META_URL_PREFIX = `https://github.com/MetaCubeX/mihomo/releases/download`;
|
||||
"https://github.com/vffuunnyy/mihetero/releases/download/Prerelease-xhttp/version.txt";
|
||||
const META_URL_PREFIX = `https://github.com/vffuunnyy/mihetero/releases/download`;
|
||||
let META_VERSION;
|
||||
|
||||
const META_MAP = {
|
||||
@@ -187,7 +187,7 @@ function clashMeta() {
|
||||
const name = META_MAP[`${platform}-${arch}`];
|
||||
const isWin = platform === "win32";
|
||||
const urlExt = isWin ? "zip" : "gz";
|
||||
const downloadURL = `${META_URL_PREFIX}/${META_VERSION}/${name}-${META_VERSION}.${urlExt}`;
|
||||
const downloadURL = `${META_URL_PREFIX}/Prerelease-xhttp/${name}-${META_VERSION}.${urlExt}`;
|
||||
const exeFile = `${name}${isWin ? ".exe" : ""}`;
|
||||
const zipFile = `${name}-${META_VERSION}.${urlExt}`;
|
||||
|
||||
|
||||
1951
src-tauri/Cargo.lock
generated
1951
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "koala-clash"
|
||||
version = "0.2.6"
|
||||
version = "0.2.8"
|
||||
description = "koala clash"
|
||||
authors = ["zzzgydi", "wonfen", "MystiPanda", "coolcoala"]
|
||||
license = "GPL-3.0-only"
|
||||
|
||||
@@ -20,12 +20,7 @@ impl IClashTemp {
|
||||
map.insert(key.clone(), template.0.get(key).unwrap().clone());
|
||||
}
|
||||
});
|
||||
// 确保 secret 字段存在且不为空
|
||||
if let Some(Value::String(s)) = map.get_mut("secret") {
|
||||
if s.is_empty() {
|
||||
*s = "set-your-secret".to_string();
|
||||
}
|
||||
}
|
||||
// Allow empty secret - user may want to disable authentication
|
||||
Self(Self::guard(map))
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -87,7 +82,13 @@ impl IClashTemp {
|
||||
let mixed_port = Self::guard_mixed_port(&config);
|
||||
let socks_port = Self::guard_socks_port(&config);
|
||||
let port = Self::guard_port(&config);
|
||||
let ctrl = Self::guard_server_ctrl(&config);
|
||||
|
||||
// Only set external-controller if it doesn't exist or is invalid
|
||||
// Don't overwrite valid user-configured values
|
||||
if !config.contains_key("external-controller") {
|
||||
config.insert("external-controller".into(), "127.0.0.1:9097".into());
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
config.insert("redir-port".into(), redir_port.into());
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -95,7 +96,6 @@ impl IClashTemp {
|
||||
config.insert("mixed-port".into(), mixed_port.into());
|
||||
config.insert("socks-port".into(), socks_port.into());
|
||||
config.insert("port".into(), port.into());
|
||||
config.insert("external-controller".into(), ctrl.into());
|
||||
|
||||
// 强制覆盖 external-controller-cors 字段,允许本地和 tauri 前端
|
||||
let mut cors_map = Mapping::new();
|
||||
|
||||
@@ -4,7 +4,7 @@ use tokio::sync::{mpsc, oneshot};
|
||||
use tokio::time::{sleep, timeout, Duration};
|
||||
|
||||
use crate::config::{Config, IVerge};
|
||||
use crate::core::async_proxy_query::AsyncProxyQuery;
|
||||
use crate::core::{async_proxy_query::AsyncProxyQuery, handle};
|
||||
use crate::logging_error;
|
||||
use crate::utils::logging::Type;
|
||||
use once_cell::sync::Lazy;
|
||||
@@ -231,6 +231,11 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
ProxyEvent::AppStopping => {
|
||||
log::info!(target: "app", "Cleaning up proxy state");
|
||||
Self::update_state_timestamp(state, |s| {
|
||||
s.sys_enabled = false;
|
||||
s.pac_enabled = false;
|
||||
s.is_healthy = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,6 +284,10 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
|
||||
async fn check_and_restore_proxy(state: &Arc<RwLock<ProxyState>>) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip system proxy guard check");
|
||||
return;
|
||||
}
|
||||
let (sys_enabled, pac_enabled) = {
|
||||
let s = state.read();
|
||||
(s.sys_enabled, s.pac_enabled)
|
||||
@@ -298,6 +307,11 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
|
||||
async fn check_and_restore_pac_proxy(state: &Arc<RwLock<ProxyState>>) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip PAC proxy restore check");
|
||||
return;
|
||||
}
|
||||
|
||||
let current = Self::get_auto_proxy_with_timeout().await;
|
||||
let expected = Self::get_expected_pac_config();
|
||||
|
||||
@@ -320,6 +334,11 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
|
||||
async fn check_and_restore_sys_proxy(state: &Arc<RwLock<ProxyState>>) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip system proxy restore check");
|
||||
return;
|
||||
}
|
||||
|
||||
let current = Self::get_sys_proxy_with_timeout().await;
|
||||
let expected = Self::get_expected_sys_proxy();
|
||||
|
||||
@@ -344,6 +363,11 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
|
||||
async fn enable_system_proxy(state: &Arc<RwLock<ProxyState>>) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip enabling system proxy");
|
||||
return;
|
||||
}
|
||||
|
||||
log::info!(target: "app", "Enabling system proxy");
|
||||
|
||||
let pac_enabled = state.read().pac_enabled;
|
||||
@@ -373,6 +397,11 @@ impl EventDrivenProxyManager {
|
||||
}
|
||||
|
||||
async fn switch_proxy_mode(state: &Arc<RwLock<ProxyState>>, to_pac: bool) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip proxy mode switch");
|
||||
return;
|
||||
}
|
||||
|
||||
log::info!(target: "app", "Switching to {} mode", if to_pac { "PAC" } else { "HTTP Proxy" });
|
||||
|
||||
if to_pac {
|
||||
@@ -507,6 +536,10 @@ impl EventDrivenProxyManager {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip PAC proxy restore");
|
||||
return;
|
||||
}
|
||||
Self::execute_sysproxy_command(&["pac", expected_url]).await;
|
||||
}
|
||||
}
|
||||
@@ -519,6 +552,10 @@ impl EventDrivenProxyManager {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip system proxy restore");
|
||||
return;
|
||||
}
|
||||
let address = format!("{}:{}", expected.host, expected.port);
|
||||
Self::execute_sysproxy_command(&["global", &address, &expected.bypass]).await;
|
||||
}
|
||||
@@ -526,6 +563,15 @@ impl EventDrivenProxyManager {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
async fn execute_sysproxy_command(args: &[&str]) {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(
|
||||
target: "app",
|
||||
"Application is exiting, cancel calling sysproxy.exe, args: {:?}",
|
||||
args
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
use crate::utils::dirs;
|
||||
#[allow(unused_imports)] // creation_flags必须
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
@@ -69,6 +69,10 @@ impl Sysopt {
|
||||
|
||||
/// init the sysproxy
|
||||
pub async fn update_sysproxy(&self) -> Result<()> {
|
||||
if Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip updating sysproxy");
|
||||
return Ok(());
|
||||
}
|
||||
let _lock = self.update_sysproxy.lock().await;
|
||||
|
||||
let port = Config::verge()
|
||||
@@ -185,6 +189,10 @@ impl Sysopt {
|
||||
|
||||
/// reset the sysproxy
|
||||
pub async fn reset_sysproxy(&self) -> Result<()> {
|
||||
if Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip resetting sysproxy");
|
||||
return Ok(());
|
||||
}
|
||||
let _lock = self.reset_sysproxy.lock().await;
|
||||
//直接关闭所有代理
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
|
||||
@@ -184,11 +184,19 @@ impl Tray {
|
||||
}
|
||||
|
||||
pub fn init(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray initialization");
|
||||
return Ok(());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 更新托盘点击行为
|
||||
pub fn update_click_behavior(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray click behavior update");
|
||||
return Ok(());
|
||||
}
|
||||
let app_handle = handle::Handle::global().app_handle().unwrap();
|
||||
let tray_event = { Config::verge().latest().tray_event.clone() };
|
||||
let tray_event: String = tray_event.unwrap_or("main_window".into());
|
||||
@@ -202,6 +210,10 @@ impl Tray {
|
||||
|
||||
/// 更新托盘菜单
|
||||
pub fn update_menu(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray menu update");
|
||||
return Ok(());
|
||||
}
|
||||
// 调整最小更新间隔,确保状态及时刷新
|
||||
const MIN_UPDATE_INTERVAL: Duration = Duration::from_millis(100);
|
||||
|
||||
@@ -291,6 +303,10 @@ impl Tray {
|
||||
/// 更新托盘图标
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn update_icon(&self, _rate: Option<Rate>) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray icon update");
|
||||
return Ok(());
|
||||
}
|
||||
let app_handle = match handle::Handle::global().app_handle() {
|
||||
Some(handle) => handle,
|
||||
None => {
|
||||
@@ -328,6 +344,10 @@ impl Tray {
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub fn update_icon(&self, _rate: Option<Rate>) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray icon update");
|
||||
return Ok(());
|
||||
}
|
||||
let app_handle = match handle::Handle::global().app_handle() {
|
||||
Some(handle) => handle,
|
||||
None => {
|
||||
@@ -361,6 +381,10 @@ impl Tray {
|
||||
|
||||
/// 更新托盘显示状态的函数
|
||||
pub fn update_tray_display(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray display update");
|
||||
return Ok(());
|
||||
}
|
||||
let app_handle = handle::Handle::global().app_handle().unwrap();
|
||||
let _tray = app_handle.tray_by_id("main").unwrap();
|
||||
|
||||
@@ -372,6 +396,10 @@ impl Tray {
|
||||
|
||||
/// 更新托盘提示
|
||||
pub fn update_tooltip(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray tooltip update");
|
||||
return Ok(());
|
||||
}
|
||||
let app_handle = match handle::Handle::global().app_handle() {
|
||||
Some(handle) => handle,
|
||||
None => {
|
||||
@@ -429,6 +457,10 @@ impl Tray {
|
||||
}
|
||||
|
||||
pub fn update_part(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray partial update");
|
||||
return Ok(());
|
||||
}
|
||||
self.update_menu()?;
|
||||
self.update_icon(None)?;
|
||||
self.update_tooltip()?;
|
||||
@@ -442,6 +474,10 @@ impl Tray {
|
||||
pub fn unsubscribe_traffic(&self) {}
|
||||
|
||||
pub fn create_tray_from_handle(&self, app_handle: &AppHandle) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray creation");
|
||||
return Ok(());
|
||||
}
|
||||
log::info!(target: "app", "Creating system tray from AppHandle");
|
||||
|
||||
// 获取图标
|
||||
@@ -509,6 +545,10 @@ impl Tray {
|
||||
|
||||
// 托盘统一的状态更新函数
|
||||
pub fn update_all_states(&self) -> Result<()> {
|
||||
if handle::Handle::global().is_exiting() {
|
||||
log::debug!(target: "app", "Application is exiting, skip tray state update");
|
||||
return Ok(());
|
||||
}
|
||||
// 确保所有状态更新完成
|
||||
self.update_menu()?;
|
||||
self.update_icon(None)?;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
use crate::AppHandleManager;
|
||||
use crate::{
|
||||
config::Config,
|
||||
core::{handle, sysopt, CoreManager},
|
||||
core::{event_driven_proxy::EventDrivenProxyManager, handle, sysopt, CoreManager},
|
||||
logging,
|
||||
module::mihomo::MihomoManager,
|
||||
utils::logging::Type,
|
||||
@@ -69,6 +69,7 @@ pub fn quit() {
|
||||
// 获取应用句柄并设置退出标志
|
||||
let app_handle = handle::Handle::global().app_handle().unwrap();
|
||||
handle::Handle::global().set_is_exiting();
|
||||
EventDrivenProxyManager::global().notify_app_stopping();
|
||||
|
||||
// 优先关闭窗口,提供立即反馈
|
||||
if let Some(window) = handle::Handle::global().get_window() {
|
||||
|
||||
@@ -7,7 +7,11 @@ mod module;
|
||||
mod process;
|
||||
mod state;
|
||||
mod utils;
|
||||
use crate::{core::hotkey, process::AsyncHandler, utils::resolve};
|
||||
use crate::{
|
||||
core::{event_driven_proxy::EventDrivenProxyManager, hotkey},
|
||||
process::AsyncHandler,
|
||||
utils::resolve,
|
||||
};
|
||||
use config::Config;
|
||||
use std::sync::{Mutex, Once};
|
||||
use tauri::AppHandle;
|
||||
@@ -98,15 +102,35 @@ pub fn run() {
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = tauri::Builder::default()
|
||||
.plugin(tauri_plugin_single_instance::init(|_app, argv, _cwd| {
|
||||
// Handle deep link when a second instance is invoked: forward URL to the running instance
|
||||
if let Some(url) = argv
|
||||
.iter()
|
||||
.find(|a| a.starts_with("clash://") || a.starts_with("koala-clash://"))
|
||||
.cloned()
|
||||
{
|
||||
// Robust scheduling avoids races with lightweight/window
|
||||
resolve::schedule_handle_deep_link(url);
|
||||
}
|
||||
// When a second instance is invoked, always show the window
|
||||
AsyncHandler::spawn(move || async move {
|
||||
// Exit lightweight mode if active
|
||||
if crate::module::lightweight::is_in_lightweight_mode() {
|
||||
logging!(info, Type::System, true, "Second instance detected: exiting lightweight mode");
|
||||
crate::module::lightweight::exit_lightweight_mode();
|
||||
// Wait for lightweight mode to fully exit
|
||||
for _ in 0..50 {
|
||||
if !crate::module::lightweight::is_in_lightweight_mode() {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(20)).await;
|
||||
}
|
||||
}
|
||||
|
||||
// Show the main window
|
||||
logging!(info, Type::System, true, "Second instance detected: showing main window");
|
||||
let _ = crate::utils::window_manager::WindowManager::show_main_window();
|
||||
|
||||
// Handle deep link if present
|
||||
if let Some(url) = argv
|
||||
.iter()
|
||||
.find(|a| a.starts_with("clash://") || a.starts_with("koala-clash://"))
|
||||
.cloned()
|
||||
{
|
||||
logging!(info, Type::System, true, "Second instance with deep link: {}", url);
|
||||
resolve::schedule_handle_deep_link(url);
|
||||
}
|
||||
});
|
||||
}))
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
@@ -400,17 +424,27 @@ pub fn run() {
|
||||
}
|
||||
}
|
||||
tauri::RunEvent::Exit => {
|
||||
// avoid duplicate cleanup
|
||||
if core::handle::Handle::global().is_exiting() {
|
||||
return;
|
||||
let handle = core::handle::Handle::global();
|
||||
|
||||
if handle.is_exiting() {
|
||||
logging!(
|
||||
debug,
|
||||
Type::System,
|
||||
"Exit event triggered, but exit flow already executed, skip duplicate cleanup"
|
||||
);
|
||||
} else {
|
||||
logging!(debug, Type::System, "Exit event triggered, executing cleanup flow");
|
||||
handle.set_is_exiting();
|
||||
EventDrivenProxyManager::global().notify_app_stopping();
|
||||
feat::clean();
|
||||
}
|
||||
feat::clean();
|
||||
}
|
||||
tauri::RunEvent::WindowEvent { label, event, .. } => {
|
||||
if label == "main" {
|
||||
match event {
|
||||
tauri::WindowEvent::CloseRequested { api, .. } => {
|
||||
#[cfg(target_os = "macos")]
|
||||
AppHandleManager::global().set_activation_policy_accessory();
|
||||
if core::handle::Handle::global().is_exiting() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,8 @@ impl NetworkManager {
|
||||
request_builder = request_builder
|
||||
.header("x-hwid", &sys_info.hwid)
|
||||
.header("x-device-os", &sys_info.os_type)
|
||||
.header("x-ver-os", &sys_info.os_ver);
|
||||
.header("x-ver-os", &sys_info.os_ver)
|
||||
.header("x-device-model", &sys_info.device_model);
|
||||
}
|
||||
|
||||
request_builder
|
||||
|
||||
@@ -466,7 +466,7 @@ pub fn create_window(is_show: bool) -> bool {
|
||||
.decorations(true)
|
||||
.fullscreen(false)
|
||||
.inner_size(DEFAULT_WIDTH as f64, DEFAULT_HEIGHT as f64)
|
||||
.min_inner_size(1000.0, 800.0)
|
||||
.min_inner_size(1000.0, 700.0)
|
||||
.visible(true) // 立即显示窗口,避免用户等待
|
||||
.initialization_script(
|
||||
r#"
|
||||
|
||||
@@ -6,17 +6,172 @@ pub struct SystemInfo {
|
||||
pub hwid: String,
|
||||
pub os_type: String,
|
||||
pub os_ver: String,
|
||||
pub device_model: String,
|
||||
}
|
||||
|
||||
pub static SYSTEM_INFO: Lazy<SystemInfo> = Lazy::new(|| {
|
||||
let os_info = os_info::get();
|
||||
SystemInfo {
|
||||
hwid: machine_uid::get().unwrap_or_else(|_| "unknown_hwid".to_string()),
|
||||
os_type: os_info.os_type().to_string(),
|
||||
os_ver: os_info.version().to_string(),
|
||||
let hwid = machine_uid::get().unwrap_or_else(|_| "unknown_hwid".to_string());
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
SystemInfo {
|
||||
hwid,
|
||||
os_type: "Windows".to_string(),
|
||||
os_ver: get_windows_build_name(),
|
||||
device_model: get_windows_edition(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
SystemInfo {
|
||||
hwid,
|
||||
os_type: "macOS".to_string(),
|
||||
os_ver: get_macos_version(),
|
||||
device_model: get_mac_model(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
SystemInfo {
|
||||
hwid,
|
||||
os_type: "Linux".to_string(),
|
||||
os_ver: get_linux_distro_version(),
|
||||
device_model: get_linux_distro_name(),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
pub fn get_system_info() -> &'static SystemInfo {
|
||||
&SYSTEM_INFO
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn get_windows_build_name() -> String {
|
||||
use winreg::enums::*;
|
||||
use winreg::RegKey;
|
||||
|
||||
let hklm = match RegKey::predef(HKEY_LOCAL_MACHINE).open_subkey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion") {
|
||||
Ok(key) => key,
|
||||
Err(_) => return "Unknown".to_string(),
|
||||
};
|
||||
|
||||
// Пытаемся получить DisplayVersion (например, "24H2", "23H2", "22H2")
|
||||
if let Ok(display_version) = hklm.get_value::<String, _>("DisplayVersion") {
|
||||
return display_version;
|
||||
}
|
||||
|
||||
// Если DisplayVersion нет, получаем ReleaseId
|
||||
if let Ok(release_id) = hklm.get_value::<String, _>("ReleaseId") {
|
||||
return release_id;
|
||||
}
|
||||
|
||||
// В крайнем случае возвращаем номер сборки
|
||||
if let Ok(build) = hklm.get_value::<String, _>("CurrentBuild") {
|
||||
return format!("Build {}", build);
|
||||
}
|
||||
|
||||
"Unknown".to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn get_windows_edition() -> String {
|
||||
use winreg::enums::*;
|
||||
use winreg::RegKey;
|
||||
|
||||
let hklm = match RegKey::predef(HKEY_LOCAL_MACHINE).open_subkey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion") {
|
||||
Ok(key) => key,
|
||||
Err(_) => return "Windows".to_string(),
|
||||
};
|
||||
|
||||
let product_name = hklm.get_value::<String, _>("ProductName").unwrap_or_else(|_| "Windows".to_string());
|
||||
|
||||
product_name
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn get_macos_version() -> String {
|
||||
use std::process::Command;
|
||||
|
||||
let output = Command::new("sw_vers")
|
||||
.arg("-productVersion")
|
||||
.output();
|
||||
|
||||
match output {
|
||||
Ok(output) if output.status.success() => {
|
||||
String::from_utf8_lossy(&output.stdout).trim().to_string()
|
||||
}
|
||||
_ => {
|
||||
// Fallback to os_info
|
||||
let os_info = os_info::get();
|
||||
os_info.version().to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn get_mac_model() -> String {
|
||||
use std::process::Command;
|
||||
|
||||
// Получаем идентификатор модели (например, "MacBookPro18,3")
|
||||
let output = Command::new("sysctl")
|
||||
.arg("-n")
|
||||
.arg("hw.model")
|
||||
.output();
|
||||
|
||||
match output {
|
||||
Ok(output) if output.status.success() => {
|
||||
let model = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
if !model.is_empty() {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Если не получилось, пробуем получить marketing name
|
||||
let output = Command::new("system_profiler")
|
||||
.arg("SPHardwareDataType")
|
||||
.output();
|
||||
|
||||
if let Ok(output) = output {
|
||||
if output.status.success() {
|
||||
let text = String::from_utf8_lossy(&output.stdout);
|
||||
for line in text.lines() {
|
||||
if line.contains("Model Name:") {
|
||||
if let Some(name) = line.split(':').nth(1) {
|
||||
return name.trim().to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"Mac".to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_linux_distro_version() -> String {
|
||||
let os_info = os_info::get();
|
||||
|
||||
// os_info::Version может содержать версию дистрибутива
|
||||
let version = os_info.version();
|
||||
let version_str = version.to_string();
|
||||
|
||||
if version_str != "Unknown" && !version_str.is_empty() {
|
||||
version_str
|
||||
} else {
|
||||
"Unknown".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_linux_distro_name() -> String {
|
||||
let os_info = os_info::get();
|
||||
|
||||
// Получаем тип дистрибутива (Ubuntu, Fedora, etc.)
|
||||
let os_type = os_info.os_type();
|
||||
|
||||
format!("{}", os_type)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.8",
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"bundle": {
|
||||
"active": true,
|
||||
@@ -11,9 +11,15 @@
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": ["resources", "resources/locales/*"],
|
||||
"resources": [
|
||||
"resources",
|
||||
"resources/locales/*"
|
||||
],
|
||||
"publisher": "Koala Clash",
|
||||
"externalBin": ["sidecar/koala-mihomo", "sidecar/koala-mihomo-alpha"],
|
||||
"externalBin": [
|
||||
"sidecar/koala-mihomo",
|
||||
"sidecar/koala-mihomo-alpha"
|
||||
],
|
||||
"copyright": "GNU General Public License v3.0",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "Koala Clash",
|
||||
@@ -40,18 +46,28 @@
|
||||
},
|
||||
"deep-link": {
|
||||
"desktop": {
|
||||
"schemes": ["clash", "koala-clash"]
|
||||
"schemes": [
|
||||
"clash",
|
||||
"koala-clash"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"security": {
|
||||
"capabilities": ["desktop-capability", "migrated"],
|
||||
"capabilities": [
|
||||
"desktop-capability",
|
||||
"migrated"
|
||||
],
|
||||
"assetProtocol": {
|
||||
"scope": ["$APPDATA/**", "$RESOURCE/../**", "**"],
|
||||
"scope": [
|
||||
"$APPDATA/**",
|
||||
"$RESOURCE/../**",
|
||||
"**"
|
||||
],
|
||||
"enable": true
|
||||
},
|
||||
"csp": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import React, { useState, useEffect, useMemo, useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { cn } from "@root/lib/utils";
|
||||
|
||||
// Компоненты и иконки
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -18,15 +17,13 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { ChevronsUpDown, Timer, WholeWord } from "lucide-react";
|
||||
import {AlertTriangle, ChevronsUpDown, Timer, WholeWord} from "lucide-react";
|
||||
|
||||
// Логика
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
import { useAppData } from "@/providers/app-data-provider";
|
||||
import delayManager from "@/services/delay";
|
||||
import { updateProxy, deleteConnection } from "@/services/api";
|
||||
|
||||
// --- Типы и константы ---
|
||||
const STORAGE_KEY_GROUP = "clash-verge-selected-proxy-group";
|
||||
const STORAGE_KEY_SORT_TYPE = "clash-verge-proxy-sort-type";
|
||||
const presetList = ["DIRECT", "REJECT", "REJECT-DROP", "PASS", "COMPATIBLE"];
|
||||
@@ -40,7 +37,6 @@ interface IProxyGroup {
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
// --- Вспомогательная функция для цвета задержки ---
|
||||
function getDelayColorClasses(delayValue: number): string {
|
||||
if (delayValue < 0) {
|
||||
return "text-muted-foreground border-border";
|
||||
@@ -51,7 +47,6 @@ function getDelayColorClasses(delayValue: number): string {
|
||||
return "text-green-600 border-green-500/40 dark:text-green-400 dark:border-green-400/30";
|
||||
}
|
||||
|
||||
// --- Дочерний компонент для элемента списка с "живым" обновлением пинга ---
|
||||
const ProxySelectItem = ({
|
||||
proxyName,
|
||||
groupName,
|
||||
@@ -268,7 +263,6 @@ export const ProxySelectors: React.FC = () => {
|
||||
}))
|
||||
.filter((p: { name: string }) => p.name);
|
||||
|
||||
// Удаляем дубли по имени прокси
|
||||
const uniqueNames = new Set<string>();
|
||||
options = rawOptions.filter((proxy: any) => {
|
||||
if (!uniqueNames.has(proxy.name)) {
|
||||
@@ -306,11 +300,20 @@ export const ProxySelectors: React.FC = () => {
|
||||
disabled={isGlobalMode || isDirectMode}
|
||||
>
|
||||
<SelectTrigger className="w-100">
|
||||
{isGlobalMode ? (
|
||||
<div className="flex items-center gap-2 text-destructive">
|
||||
<AlertTriangle className="h-4 w-4 text-destructive" />
|
||||
<span className="font-medium text-sm">
|
||||
{t("Global Mode Active")}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center gap-2 truncate">
|
||||
<span className="truncate">
|
||||
<SelectValue placeholder={t("Select a group...")} />
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{selectorGroups.map((group: IProxyGroup) => (
|
||||
|
||||
@@ -32,7 +32,6 @@ import { BaseSearchBox } from "../base/base-search-box";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { cn } from "@root/lib/utils";
|
||||
|
||||
// --- Компоненты shadcn/ui и иконки ---
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
@@ -85,7 +84,6 @@ import {
|
||||
ArrowUpToLine,
|
||||
} from "lucide-react";
|
||||
|
||||
// --- Вспомогательные функции, константы и валидаторы ---
|
||||
const portValidator = (value: string): boolean =>
|
||||
/^(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/.test(
|
||||
value,
|
||||
@@ -109,7 +107,6 @@ interface Props {
|
||||
onSave?: (prev?: string, curr?: string) => void;
|
||||
}
|
||||
|
||||
// --- Новый компонент Combobox (одиночный выбор) ---
|
||||
const Combobox = ({
|
||||
options,
|
||||
value,
|
||||
@@ -123,7 +120,7 @@ const Combobox = ({
|
||||
}) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<Popover open={open} onOpenChange={setOpen} modal={true}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -168,7 +165,6 @@ const Combobox = ({
|
||||
);
|
||||
};
|
||||
|
||||
// --- Новый компонент MultiSelectCombobox (множественный выбор) ---
|
||||
const MultiSelectCombobox = ({
|
||||
options,
|
||||
value,
|
||||
@@ -194,7 +190,7 @@ const MultiSelectCombobox = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<Popover open={open} onOpenChange={setOpen} modal={true}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -246,7 +242,6 @@ const MultiSelectCombobox = ({
|
||||
);
|
||||
};
|
||||
|
||||
// --- Новый компонент для элемента списка групп ---
|
||||
const EditorGroupItem = ({
|
||||
type,
|
||||
group,
|
||||
@@ -407,22 +402,6 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (currData === "" || !visualization) return;
|
||||
try {
|
||||
let obj = yaml.load(currData) as {
|
||||
prepend: [];
|
||||
append: [];
|
||||
delete: [];
|
||||
} | null;
|
||||
setPrependSeq(obj?.prepend || []);
|
||||
setAppendSeq(obj?.append || []);
|
||||
setDeleteSeq(obj?.delete || []);
|
||||
} catch (e) {
|
||||
/* Ignore parsing errors while typing */
|
||||
}
|
||||
}, [visualization, currData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prependSeq && appendSeq && deleteSeq && visualization) {
|
||||
const serialize = () => {
|
||||
@@ -580,9 +559,8 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
{visualization ? (
|
||||
<Form {...form}>
|
||||
<form className="h-full flex gap-4">
|
||||
{/* Левая панель: Конструктор групп */}
|
||||
<div className="w-1/2 flex flex-col border rounded-md p-4">
|
||||
<h3 className="text-lg font-medium mb-4">Constructor</h3>
|
||||
<h3 className="text-lg font-medium mb-4">{t("Constructor")}</h3>
|
||||
<Separator className="mb-4" />
|
||||
<div className="space-y-3 overflow-y-auto p-1 -mr-3 ">
|
||||
<FormField
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@theme {
|
||||
--tailwind-darkMode: "class";
|
||||
}
|
||||
@variant dark (&:where(.dark, .dark *));
|
||||
|
||||
@theme inline {
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
|
||||
@@ -680,5 +680,13 @@
|
||||
"Template without RU Rules": "Without-ru template",
|
||||
"Stopping Core...": "Stopping Core...",
|
||||
"Uninstalling Service...": "Uninstalling Service...",
|
||||
"Try running core as Sidecar...": "Try running core as Sidecar..."
|
||||
"Try running core as Sidecar...": "Try running core as Sidecar...",
|
||||
"Global Mode Active": "Global Mode Active",
|
||||
"Update Interval (mins)": "Update Interval (mins)",
|
||||
"Profile Name": "Profile Name",
|
||||
"Profile Description": "Profile Description",
|
||||
"Constructor": "Group constructor",
|
||||
"Leave blank to use the URL above": "Leave blank to use the URL above",
|
||||
"No profiles available": "No profiles available",
|
||||
"Configuration saved successfully": "Configuration saved successfully"
|
||||
}
|
||||
|
||||
@@ -482,14 +482,14 @@
|
||||
"Direct Mode": "Прямой режим",
|
||||
"Enable Tray Speed": "Показывать скорость в трее",
|
||||
"Enable Tray Icon": "Показывать значок в трее",
|
||||
"LightWeight Mode": "LightWeight Mode",
|
||||
"LightWeight Mode": "Легковесный режим",
|
||||
"LightWeight Mode Info": "Режим, в котором работает только ядро Clash, а графический интрефейс закрыт",
|
||||
"LightWeight Mode Settings": "Настройки LightWeight Mode",
|
||||
"Enter LightWeight Mode Now": "Войти в LightWeight Mode",
|
||||
"Auto Enter LightWeight Mode": "Автоматический вход в LightWeight Mode",
|
||||
"Auto Enter LightWeight Mode Info": "Автоматически включать LightWeight Mode, если окно закрыто определенное время",
|
||||
"Auto Enter LightWeight Mode Delay": "Задержка включения LightWeight Mode",
|
||||
"When closing the window, LightWeight Mode will be automatically activated after _n minutes": "При закрытии окна LightWeight Mode будет автоматически активирован через {{n}} минут",
|
||||
"LightWeight Mode Settings": "Настройки легковесного режима",
|
||||
"Enter LightWeight Mode Now": "Войти в легковесный режим",
|
||||
"Auto Enter LightWeight Mode": "Автоматический вход в легковесный режим",
|
||||
"Auto Enter LightWeight Mode Info": "Автоматически включать легковесный режим, если окно закрыто определенное время",
|
||||
"Auto Enter LightWeight Mode Delay": "Задержка включения легковесного режима",
|
||||
"When closing the window, LightWeight Mode will be automatically activated after _n minutes": "При закрытии окна легковесный режим будет автоматически активирован через {{n}} минут",
|
||||
"Config Validation Failed": "Ошибка проверки конфигурации подписки, проверьте файл конфигурации, изменения отменены, ошибка:",
|
||||
"Boot Config Validation Failed": "Ошибка проверки конфигурации при запуске, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
||||
"Core Change Config Validation Failed": "Ошибка проверки конфигурации при смене ядра, используется конфигурация по умолчанию, проверьте файл конфигурации, ошибка:",
|
||||
@@ -680,5 +680,13 @@
|
||||
"Template without RU Rules": "Шаблон without-ru",
|
||||
"Stopping Core...": "Остановка ядра...",
|
||||
"Uninstalling Service...": "Удаление сервиса...",
|
||||
"Try running core as Sidecar...": "Попытка запустить ядро как Sidecar..."
|
||||
"Try running core as Sidecar...": "Попытка запустить ядро как Sidecar...",
|
||||
"Global Mode Active": "Глобальный режим активен",
|
||||
"Update Interval (mins)": "Интервал обновления (в минутах)",
|
||||
"Profile Name": "Имя профиля",
|
||||
"Profile Description": "Описание профиля",
|
||||
"Constructor": "Конструктор групп",
|
||||
"Leave blank to use the URL above": "Оставьте поле пустым, чтобы использовать URL-адрес выше",
|
||||
"No profiles available": "Нет доступных профилей",
|
||||
"Configuration saved successfully": "Конфигурация успешно сохранена"
|
||||
}
|
||||
|
||||
16
src/main.tsx
16
src/main.tsx
@@ -43,6 +43,22 @@ document.addEventListener("keydown", (event) => {
|
||||
disabledShortcuts && event.preventDefault();
|
||||
});
|
||||
|
||||
// Disable context menu everywhere except in input fields and textareas
|
||||
document.addEventListener("contextmenu", (event) => {
|
||||
const target = event.target as HTMLElement;
|
||||
|
||||
// Allow context menu for input fields, textareas, and editable content
|
||||
const isEditable =
|
||||
target.tagName === "INPUT" ||
|
||||
target.tagName === "TEXTAREA" ||
|
||||
target.isContentEditable ||
|
||||
target.closest('[contenteditable="true"]') !== null;
|
||||
|
||||
if (!isEditable) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
const contexts = [
|
||||
<ThemeModeProvider />,
|
||||
<LoadingCacheProvider />,
|
||||
|
||||
Reference in New Issue
Block a user