Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f5d2b15e0 | ||
|
|
7fc9631434 | ||
|
|
df5953dd7b | ||
|
|
8f5b2b4a0e | ||
|
|
43c63ffa70 | ||
|
|
6779bc7459 | ||
|
|
664be2d0ba | ||
|
|
6113898b69 | ||
|
|
79aad6b5c2 | ||
|
|
6da7757d36 | ||
|
|
dbb3cb8cc8 | ||
|
|
579f36a1dd | ||
|
|
72c2b306cf | ||
|
|
c2673cd396 | ||
|
|
8eb152816a |
6
.github/workflows/release.yml
vendored
@@ -54,6 +54,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tagName: v__VERSION__
|
tagName: v__VERSION__
|
||||||
releaseName: "Clash Verge v__VERSION__"
|
releaseName: "Clash Verge v__VERSION__"
|
||||||
releaseBody: "This is a release."
|
releaseBody: "Clash Verge now supports Windows and macos(intel)."
|
||||||
releaseDraft: true
|
releaseDraft: false
|
||||||
prerelease: false
|
prerelease: true
|
||||||
|
|||||||
1
.gitignore
vendored
@@ -3,3 +3,4 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
update.json
|
||||||
|
|||||||
10
README.md
@@ -26,7 +26,7 @@ yarn install
|
|||||||
Then download the clash binary... Or you can download it from [clash premium release](https://github.com/Dreamacro/clash/releases/tag/premium) and rename it according to [tauri config](https://tauri.studio/en/docs/api/config#tauri.bundle.externalBin).
|
Then download the clash binary... Or you can download it from [clash premium release](https://github.com/Dreamacro/clash/releases/tag/premium) and rename it according to [tauri config](https://tauri.studio/en/docs/api/config#tauri.bundle.externalBin).
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
yarn run predev
|
yarn run check
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run
|
Then run
|
||||||
@@ -42,8 +42,12 @@ yarn dev
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="./docs/demo1.png" alt="demo1" width="42%" />
|
<img src="./docs/demo1.png" alt="demo1" width="32%" />
|
||||||
<img src="./docs/demo2.png" alt="demo2" width="42%" />
|
<img src="./docs/demo2.png" alt="demo2" width="32%" />
|
||||||
|
<img src="./docs/demo3.png" alt="demo3" width="32%" />
|
||||||
|
<img src="./docs/demo4.png" alt="demo4" width="32%" />
|
||||||
|
<img src="./docs/demo5.png" alt="demo5" width="32%" />
|
||||||
|
<img src="./docs/demo6.png" alt="demo6" width="32%" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|||||||
BIN
docs/demo1.png
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 21 KiB |
BIN
docs/demo2.png
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 20 KiB |
BIN
docs/demo3.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
docs/demo4.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
docs/demo5.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
docs/demo6.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clash-verge",
|
"name": "clash-verge",
|
||||||
"version": "0.0.7",
|
"version": "0.0.9",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cargo tauri dev",
|
"dev": "cargo tauri dev",
|
||||||
|
|||||||
208
src-tauri/Cargo.lock
generated
@@ -54,6 +54,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
"tauri-plugin-shadows",
|
"tauri-plugin-shadows",
|
||||||
|
"tauri-plugin-vibrancy",
|
||||||
"tokio",
|
"tokio",
|
||||||
"warp",
|
"warp",
|
||||||
"winreg 0.10.1",
|
"winreg 0.10.1",
|
||||||
@@ -184,16 +185,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake3"
|
name = "blake3"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413"
|
checksum = "882e99e4a0cb2ae6cb6e442102e8e6b7131718d94110e64c3e6a34ea9b106f37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
"digest",
|
"digest 0.10.1",
|
||||||
"rayon",
|
"rayon",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -212,6 +213,15 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "0.2.17"
|
version = "0.2.17"
|
||||||
@@ -233,9 +243,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.8.0"
|
version = "3.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
|
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@@ -377,8 +387,8 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"cocoa-foundation",
|
"cocoa-foundation",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"core-graphics 0.22.3",
|
"core-graphics",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
"objc",
|
"objc",
|
||||||
@@ -392,7 +402,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -420,50 +430,22 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys 0.7.0",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.2"
|
version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
|
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation-sys"
|
name = "core-foundation-sys"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-graphics"
|
|
||||||
version = "0.19.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"core-foundation 0.7.0",
|
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-graphics"
|
name = "core-graphics"
|
||||||
version = "0.22.3"
|
version = "0.22.3"
|
||||||
@@ -471,7 +453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -484,24 +466,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-video-sys"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 0.1.10",
|
|
||||||
"core-foundation-sys 0.7.0",
|
|
||||||
"core-graphics 0.19.2",
|
|
||||||
"libc",
|
|
||||||
"objc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@@ -522,9 +491,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
|
checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
@@ -543,9 +512,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-epoch"
|
name = "crossbeam-epoch"
|
||||||
version = "0.9.5"
|
version = "0.9.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
|
checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
@@ -556,14 +525,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
|
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cssparser"
|
name = "cssparser"
|
||||||
version = "0.27.2"
|
version = "0.27.2"
|
||||||
@@ -685,6 +663,18 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer 0.10.0",
|
||||||
|
"crypto-common",
|
||||||
|
"generic-array",
|
||||||
|
"subtle",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs"
|
name = "dirs"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
@@ -766,9 +756,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embed_plist"
|
name = "embed_plist"
|
||||||
version = "1.2.0"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99"
|
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
@@ -1269,9 +1259,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.3.9"
|
version = "0.3.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd"
|
checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -1485,9 +1475,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.7.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -2135,9 +2125,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-float"
|
name = "ordered-float"
|
||||||
version = "2.9.0"
|
version = "2.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8aa3d135650b150c29f0c3e385896f9d3ceb42d2d87b02f0d7a8cbd0fc7e19a6"
|
checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
@@ -2702,15 +2692,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.11.8"
|
version = "0.11.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c4e0a76dc12a116108933f6301b95e83634e0c47b0afbed6abbaa0601e99258"
|
checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"h2",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"hyper",
|
"hyper",
|
||||||
@@ -2844,8 +2835,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87"
|
checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
]
|
]
|
||||||
@@ -2856,7 +2847,7 @@ version = "2.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e"
|
checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2996,10 +2987,10 @@ version = "0.9.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
|
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer 0.9.0",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
"digest",
|
"digest 0.9.0",
|
||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3166,10 +3157,16 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "subtle"
|
||||||
version = "1.0.84"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b"
|
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.85"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -3210,15 +3207,14 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tao"
|
name = "tao"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
source = "git+https://github.com/tauri-apps/tao?branch=next#f8866a084afe18983c91c67401d8759697578a9c"
|
source = "git+https://github.com/tauri-apps/tao?branch=next#a3a2e0cfc49ddfa8cdf65cf9870fb8e3d45b4bc0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cairo-rs",
|
"cairo-rs",
|
||||||
"cc",
|
"cc",
|
||||||
"cocoa",
|
"cocoa",
|
||||||
"core-foundation 0.9.2",
|
"core-foundation",
|
||||||
"core-graphics 0.22.3",
|
"core-graphics",
|
||||||
"core-video-sys",
|
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dispatch",
|
"dispatch",
|
||||||
"gdk",
|
"gdk",
|
||||||
@@ -3242,12 +3238,25 @@ dependencies = [
|
|||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
"serde",
|
"serde",
|
||||||
|
"tao-core-video-sys",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"windows 0.29.0",
|
"windows 0.29.0",
|
||||||
"windows_macros",
|
"windows_macros",
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tao-core-video-sys"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"objc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tar"
|
name = "tar"
|
||||||
version = "0.4.38"
|
version = "0.4.38"
|
||||||
@@ -3262,7 +3271,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri"
|
name = "tauri"
|
||||||
version = "1.0.0-beta.8"
|
version = "1.0.0-beta.8"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"attohttpc",
|
"attohttpc",
|
||||||
"base64",
|
"base64",
|
||||||
@@ -3324,7 +3333,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-codegen"
|
name = "tauri-codegen"
|
||||||
version = "1.0.0-beta.4"
|
version = "1.0.0-beta.4"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake3",
|
"blake3",
|
||||||
"kuchiki",
|
"kuchiki",
|
||||||
@@ -3342,7 +3351,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-macros"
|
name = "tauri-macros"
|
||||||
version = "1.0.0-beta.5"
|
version = "1.0.0-beta.5"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -3361,10 +3370,21 @@ dependencies = [
|
|||||||
"windows 0.29.0",
|
"windows 0.29.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-vibrancy"
|
||||||
|
version = "0.0.0"
|
||||||
|
source = "git+https://github.com/tauri-apps/tauri-plugin-vibrancy#b4fceab0d4a6d024f1b9916c126f10f513101128"
|
||||||
|
dependencies = [
|
||||||
|
"cocoa",
|
||||||
|
"objc",
|
||||||
|
"tauri",
|
||||||
|
"windows 0.29.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gtk",
|
"gtk",
|
||||||
"http",
|
"http",
|
||||||
@@ -3382,7 +3402,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime-wry"
|
name = "tauri-runtime-wry"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gtk",
|
"gtk",
|
||||||
"ico",
|
"ico",
|
||||||
@@ -3417,7 +3437,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-utils"
|
name = "tauri-utils"
|
||||||
version = "1.0.0-beta.3"
|
version = "1.0.0-beta.3"
|
||||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#46f2eae8aad7c6a228eaf48480d5603dae6454b4"
|
source = "git+https://github.com/tauri-apps/tauri?branch=next#c6e05380f7a3b5de3a12db9414a0d7d96102737a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.4.0",
|
"heck 0.4.0",
|
||||||
"html5ever",
|
"html5ever",
|
||||||
@@ -3434,13 +3454,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.2.0"
|
version = "3.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
|
"fastrand",
|
||||||
"libc",
|
"libc",
|
||||||
"rand 0.8.4",
|
|
||||||
"redox_syscall 0.2.10",
|
"redox_syscall 0.2.10",
|
||||||
"remove_dir_all",
|
"remove_dir_all",
|
||||||
"winapi",
|
"winapi",
|
||||||
@@ -4283,7 +4303,7 @@ version = "0.12.2"
|
|||||||
source = "git+https://github.com/tauri-apps/wry?rev=3284f8d442978269f7654edbdfc9bc51022eaa40#3284f8d442978269f7654edbdfc9bc51022eaa40"
|
source = "git+https://github.com/tauri-apps/wry?rev=3284f8d442978269f7654edbdfc9bc51022eaa40#3284f8d442978269f7654edbdfc9bc51022eaa40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cocoa",
|
"cocoa",
|
||||||
"core-graphics 0.22.3",
|
"core-graphics",
|
||||||
"gdk",
|
"gdk",
|
||||||
"gio",
|
"gio",
|
||||||
"glib",
|
"glib",
|
||||||
@@ -4402,18 +4422,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd"
|
name = "zstd"
|
||||||
version = "0.9.1+zstd.1.5.1"
|
version = "0.9.2+zstd.1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "538b8347df9257b7fbce37677ef7535c00a3c7bf1f81023cc328ed7fe4b41de8"
|
checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zstd-safe",
|
"zstd-safe",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-safe"
|
name = "zstd-safe"
|
||||||
version = "4.1.2+zstd.1.5.1"
|
version = "4.1.3+zstd.1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9fb4cfe2f6e6d35c5d27ecd9d256c4b6f7933c4895654917460ec56c29336cc1"
|
checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"zstd-sys",
|
"zstd-sys",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
# tauri = { git = "https://github.com/tauri-apps/tauri", rev = "5e0d59ec", features = ["api-all", "system-tray"] }
|
# tauri = { git = "https://github.com/tauri-apps/tauri", rev = "5e0d59ec", features = ["api-all", "system-tray"] }
|
||||||
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["api-all", "system-tray", "updater"] }
|
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["api-all", "system-tray", "updater"] }
|
||||||
tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] }
|
tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] }
|
||||||
|
tauri-plugin-vibrancy = { git = "https://github.com/tauri-apps/tauri-plugin-vibrancy", features = ["tauri-impl"] }
|
||||||
|
|
||||||
reqwest = { version = "0.11", features = ["json"] }
|
reqwest = { version = "0.11", features = ["json"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|||||||
@@ -142,10 +142,27 @@ pub fn patch_profile(
|
|||||||
|
|
||||||
/// restart the sidecar
|
/// restart the sidecar
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn restart_sidecar(clash_state: State<'_, ClashState>) {
|
pub fn restart_sidecar(
|
||||||
let mut clash_arc = clash_state.0.lock().unwrap();
|
clash_state: State<'_, ClashState>,
|
||||||
if let Err(err) = clash_arc.restart_sidecar() {
|
profiles_state: State<'_, ProfilesState>,
|
||||||
log::error!("{}", err);
|
) -> Result<(), String> {
|
||||||
|
let mut clash = clash_state.0.lock().unwrap();
|
||||||
|
|
||||||
|
match clash.restart_sidecar() {
|
||||||
|
Ok(_) => {
|
||||||
|
let profiles = profiles_state.0.lock().unwrap();
|
||||||
|
match profiles.activate(clash.info.clone()) {
|
||||||
|
Ok(()) => Ok(()),
|
||||||
|
Err(err) => {
|
||||||
|
log::error!("{}", err);
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
log::error!("{}", err);
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,24 +193,7 @@ pub fn patch_clash_config(payload: Mapping) -> Result<(), String> {
|
|||||||
save_clash(&config)
|
save_clash(&config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// set the system proxy
|
|
||||||
/// Tips: only support windows now
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn set_sys_proxy(enable: bool, verge_state: State<'_, VergeState>) -> Result<(), String> {
|
|
||||||
let mut verge = verge_state.0.lock().unwrap();
|
|
||||||
|
|
||||||
if let Some(mut sysproxy) = verge.cur_sysproxy.take() {
|
|
||||||
sysproxy.enable = enable;
|
|
||||||
if sysproxy.set_sys().is_err() {
|
|
||||||
log::error!("failed to set system proxy");
|
|
||||||
}
|
|
||||||
verge.cur_sysproxy = Some(sysproxy);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// get the system proxy
|
/// get the system proxy
|
||||||
/// Tips: only support windows now
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn get_sys_proxy() -> Result<SysProxyConfig, String> {
|
pub fn get_sys_proxy() -> Result<SysProxyConfig, String> {
|
||||||
match SysProxyConfig::get_sys() {
|
match SysProxyConfig::get_sys() {
|
||||||
@@ -202,6 +202,8 @@ pub fn get_sys_proxy() -> Result<SysProxyConfig, String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// get the current proxy config
|
||||||
|
/// which may not the same as system proxy
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn get_cur_proxy(verge_state: State<'_, VergeState>) -> Result<Option<SysProxyConfig>, String> {
|
pub fn get_cur_proxy(verge_state: State<'_, VergeState>) -> Result<Option<SysProxyConfig>, String> {
|
||||||
match verge_state.0.lock() {
|
match verge_state.0.lock() {
|
||||||
@@ -227,24 +229,7 @@ pub async fn patch_verge_config(
|
|||||||
verge_state: State<'_, VergeState>,
|
verge_state: State<'_, VergeState>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let mut verge = verge_state.0.lock().unwrap();
|
let mut verge = verge_state.0.lock().unwrap();
|
||||||
|
verge.patch_config(payload)
|
||||||
if payload.theme_mode.is_some() {
|
|
||||||
verge.config.theme_mode = payload.theme_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if payload.enable_self_startup.is_some() {
|
|
||||||
verge.config.enable_self_startup = payload.enable_self_startup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if payload.enable_system_proxy.is_some() {
|
|
||||||
verge.config.enable_system_proxy = payload.enable_system_proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if payload.system_proxy_bypass.is_some() {
|
|
||||||
verge.config.system_proxy_bypass = payload.system_proxy_bypass;
|
|
||||||
}
|
|
||||||
|
|
||||||
verge.config.save_file()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// start dragging window
|
/// start dragging window
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use crate::utils::{config, dirs, sysopt::SysProxyConfig};
|
use crate::utils::{config, dirs, startup, sysopt::SysProxyConfig};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use tauri::api::path::resource_dir;
|
||||||
|
|
||||||
/// ### `verge.yaml` schema
|
/// ### `verge.yaml` schema
|
||||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
@@ -7,6 +9,10 @@ pub struct VergeConfig {
|
|||||||
/// `light` or `dark`
|
/// `light` or `dark`
|
||||||
pub theme_mode: Option<String>,
|
pub theme_mode: Option<String>,
|
||||||
|
|
||||||
|
/// enable blur mode
|
||||||
|
/// maybe be able to set the alpha
|
||||||
|
pub theme_blur: Option<bool>,
|
||||||
|
|
||||||
/// can the app auto startup
|
/// can the app auto startup
|
||||||
pub enable_self_startup: Option<bool>,
|
pub enable_self_startup: Option<bool>,
|
||||||
|
|
||||||
@@ -34,6 +40,7 @@ impl VergeConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Verge App abilities
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Verge {
|
pub struct Verge {
|
||||||
pub config: VergeConfig,
|
pub config: VergeConfig,
|
||||||
@@ -41,6 +48,8 @@ pub struct Verge {
|
|||||||
pub old_sysproxy: Option<SysProxyConfig>,
|
pub old_sysproxy: Option<SysProxyConfig>,
|
||||||
|
|
||||||
pub cur_sysproxy: Option<SysProxyConfig>,
|
pub cur_sysproxy: Option<SysProxyConfig>,
|
||||||
|
|
||||||
|
pub exe_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Verge {
|
impl Default for Verge {
|
||||||
@@ -55,6 +64,7 @@ impl Verge {
|
|||||||
config: VergeConfig::new(),
|
config: VergeConfig::new(),
|
||||||
old_sysproxy: None,
|
old_sysproxy: None,
|
||||||
cur_sysproxy: None,
|
cur_sysproxy: None,
|
||||||
|
exe_path: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,4 +100,98 @@ impl Verge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// set the exe_path
|
||||||
|
pub fn set_exe_path(&mut self, package_info: &tauri::PackageInfo) {
|
||||||
|
let exe = if cfg!(target_os = "windows") {
|
||||||
|
"clash-verge.exe"
|
||||||
|
} else {
|
||||||
|
"clash-verge"
|
||||||
|
};
|
||||||
|
let path = resource_dir(package_info).unwrap().join(exe);
|
||||||
|
self.exe_path = Some(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// sync the startup when run the app
|
||||||
|
pub fn sync_startup(&self) -> Result<(), String> {
|
||||||
|
let enable = self.config.enable_self_startup.clone().unwrap_or(false);
|
||||||
|
|
||||||
|
if !enable {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
if self.exe_path.is_none() {
|
||||||
|
return Err("should init the exe_path first".into());
|
||||||
|
}
|
||||||
|
|
||||||
|
let exe_path = self.exe_path.clone().unwrap();
|
||||||
|
match startup::get_startup(&exe_path) {
|
||||||
|
Ok(sys_enable) => {
|
||||||
|
if sys_enable || (!sys_enable && startup::set_startup(true, &exe_path).is_ok()) {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err("failed to sync startup".into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => Err("failed to get system startup info".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// update the startup
|
||||||
|
fn update_startup(&mut self, enable: bool) -> Result<(), String> {
|
||||||
|
let conf_enable = self.config.enable_self_startup.clone().unwrap_or(false);
|
||||||
|
|
||||||
|
if enable == conf_enable {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
if self.exe_path.is_none() {
|
||||||
|
return Err("should init the exe_path first".into());
|
||||||
|
}
|
||||||
|
let exe_path = self.exe_path.clone().unwrap();
|
||||||
|
match startup::set_startup(enable, &exe_path) {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(_) => Err("failed to set system startup info".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// patch verge config
|
||||||
|
/// There should be only one update at a time here
|
||||||
|
/// so call the save_file at the end is savely
|
||||||
|
pub fn patch_config(&mut self, patch: VergeConfig) -> Result<(), String> {
|
||||||
|
// only change it
|
||||||
|
if patch.theme_mode.is_some() {
|
||||||
|
self.config.theme_mode = patch.theme_mode;
|
||||||
|
}
|
||||||
|
if patch.theme_blur.is_some() {
|
||||||
|
self.config.theme_blur = patch.theme_blur;
|
||||||
|
}
|
||||||
|
|
||||||
|
// should update system startup
|
||||||
|
if patch.enable_self_startup.is_some() {
|
||||||
|
let enable = patch.enable_self_startup.unwrap();
|
||||||
|
self.update_startup(enable)?;
|
||||||
|
self.config.enable_self_startup = Some(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// should update system proxy
|
||||||
|
if patch.enable_system_proxy.is_some() {
|
||||||
|
let enable = patch.enable_system_proxy.unwrap();
|
||||||
|
if let Some(mut sysproxy) = self.cur_sysproxy.take() {
|
||||||
|
sysproxy.enable = enable;
|
||||||
|
if sysproxy.set_sys().is_err() {
|
||||||
|
log::error!("failed to set system proxy");
|
||||||
|
return Err("failed to set system proxy".into());
|
||||||
|
}
|
||||||
|
self.cur_sysproxy = Some(sysproxy);
|
||||||
|
}
|
||||||
|
self.config.enable_system_proxy = Some(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo
|
||||||
|
// should update system proxt too
|
||||||
|
if patch.system_proxy_bypass.is_some() {
|
||||||
|
self.config.system_proxy_bypass = patch.system_proxy_bypass;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.config.save_file()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,16 @@ fn main() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
"restart_clash" => {
|
"restart_clash" => {
|
||||||
let clash_state = app_handle.state::<states::ClashState>();
|
let clash_state = app_handle.state::<states::ClashState>();
|
||||||
let mut clash_arc = clash_state.0.lock().unwrap();
|
let mut clash = clash_state.0.lock().unwrap();
|
||||||
if let Err(err) = clash_arc.restart_sidecar() {
|
match clash.restart_sidecar() {
|
||||||
log::error!("{}", err);
|
Ok(_) => {
|
||||||
|
let profiles = app_handle.state::<states::ProfilesState>();
|
||||||
|
let profiles = profiles.0.lock().unwrap();
|
||||||
|
if let Err(err) = profiles.activate(clash.info.clone()) {
|
||||||
|
log::error!("{}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => log::error!("{}", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"quit" => {
|
"quit" => {
|
||||||
@@ -64,7 +71,6 @@ fn main() -> std::io::Result<()> {
|
|||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
// common
|
// common
|
||||||
cmds::restart_sidecar,
|
cmds::restart_sidecar,
|
||||||
cmds::set_sys_proxy,
|
|
||||||
cmds::get_sys_proxy,
|
cmds::get_sys_proxy,
|
||||||
cmds::get_cur_proxy,
|
cmds::get_cur_proxy,
|
||||||
cmds::win_drag,
|
cmds::win_drag,
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ pub mod fetch;
|
|||||||
pub mod init;
|
pub mod init;
|
||||||
pub mod resolve;
|
pub mod resolve;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
pub mod startup;
|
||||||
pub mod sysopt;
|
pub mod sysopt;
|
||||||
|
|||||||
@@ -9,6 +9,15 @@ pub fn resolve_setup(app: &App) {
|
|||||||
let window = app.get_window("main").unwrap();
|
let window = app.get_window("main").unwrap();
|
||||||
window.set_shadow(true);
|
window.set_shadow(true);
|
||||||
|
|
||||||
|
use tauri_plugin_vibrancy::Vibrancy;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
window.apply_blur();
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
use tauri_plugin_vibrancy::MacOSVibrancy;
|
||||||
|
window.apply_vibrancy(MacOSVibrancy::AppearanceBased);
|
||||||
|
}
|
||||||
|
|
||||||
// setup a simple http server for singleton
|
// setup a simple http server for singleton
|
||||||
server::embed_server(&app.handle());
|
server::embed_server(&app.handle());
|
||||||
|
|
||||||
@@ -33,7 +42,11 @@ pub fn resolve_setup(app: &App) {
|
|||||||
log::error!("{}", err);
|
log::error!("{}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verge.set_exe_path(app.package_info());
|
||||||
verge.init_sysproxy(clash.info.port.clone());
|
verge.init_sysproxy(clash.info.port.clone());
|
||||||
|
if let Err(err) = verge.sync_startup() {
|
||||||
|
log::error!("{}", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reset system proxy
|
/// reset system proxy
|
||||||
|
|||||||
74
src-tauri/src/utils/startup.rs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
use std::io;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
static APP_KEY: &str = "ClashVerge";
|
||||||
|
|
||||||
|
/// get the startup value
|
||||||
|
/// whether as same as the exe_path
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> {
|
||||||
|
use winreg::enums::*;
|
||||||
|
use winreg::RegKey;
|
||||||
|
|
||||||
|
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
|
||||||
|
let cur_var = hkcu.open_subkey_with_flags(
|
||||||
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||||
|
KEY_READ,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
match cur_var.get_value::<String, _>(APP_KEY) {
|
||||||
|
Ok(path) => {
|
||||||
|
let exe_path = exe_path.clone();
|
||||||
|
let exe_path = exe_path.as_os_str().to_str().unwrap();
|
||||||
|
Ok(path == exe_path)
|
||||||
|
}
|
||||||
|
Err(_) => Ok(false),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// set the startup on windows
|
||||||
|
/// delete the reg key if disabled
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> {
|
||||||
|
use winreg::enums::*;
|
||||||
|
use winreg::RegKey;
|
||||||
|
|
||||||
|
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
|
||||||
|
let cur_var = hkcu.open_subkey_with_flags(
|
||||||
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||||
|
KEY_SET_VALUE,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
match enable {
|
||||||
|
true => {
|
||||||
|
let exe_path = exe_path.clone();
|
||||||
|
let exe_path = exe_path.as_os_str().to_str().unwrap();
|
||||||
|
cur_var.set_value::<&str, _>(APP_KEY, &exe_path)
|
||||||
|
}
|
||||||
|
false => cur_var.delete_value(APP_KEY),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// todo
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> {
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// todo
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
#[test]
|
||||||
|
fn test() {
|
||||||
|
let path = PathBuf::from(r"D:\Software\Clash Verge\clash-verge.exe");
|
||||||
|
|
||||||
|
assert!(set_startup(true, &path).is_ok());
|
||||||
|
assert_eq!(get_startup(&path).unwrap(), true);
|
||||||
|
|
||||||
|
assert!(set_startup(false, &path).is_ok());
|
||||||
|
assert_eq!(get_startup(&path).unwrap(), false);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "clash-verge",
|
"productName": "clash-verge",
|
||||||
"version": "0.0.7"
|
"version": "0.0.9"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": "../dist",
|
"distDir": "../dist",
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
"resizable": true,
|
"resizable": true,
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"decorations": false,
|
"decorations": false,
|
||||||
"transparent": false,
|
"transparent": true,
|
||||||
"minWidth": 600,
|
"minWidth": 600,
|
||||||
"minHeight": 520
|
"minHeight": 520
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
import useSWR, { useSWRConfig } from "swr";
|
import useSWR, { useSWRConfig } from "swr";
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
List,
|
List,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
ListSubheader,
|
ListSubheader,
|
||||||
Switch,
|
Switch,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import {
|
import { getVergeConfig, patchVergeConfig } from "../services/cmds";
|
||||||
setSysProxy,
|
|
||||||
getVergeConfig,
|
|
||||||
patchVergeConfig,
|
|
||||||
} from "../services/cmds";
|
|
||||||
import { CmdType } from "../services/types";
|
import { CmdType } from "../services/types";
|
||||||
import { version } from "../../package.json";
|
import { version } from "../../package.json";
|
||||||
import GuardState from "./guard-state";
|
import GuardState from "./guard-state";
|
||||||
import SettingItem from "./setting-item";
|
import SettingItem from "./setting-item";
|
||||||
import PaletteSwitch from "./palette-switch";
|
import PaletteSwitch from "./palette-switch";
|
||||||
|
import SysproxyTooltip from "./sysproxy-tooltip";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onError?: (err: Error) => void;
|
onError?: (err: Error) => void;
|
||||||
@@ -27,6 +25,7 @@ const SettingVerge = ({ onError }: Props) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
theme_mode: mode = "light",
|
theme_mode: mode = "light",
|
||||||
|
theme_blur: blur = false,
|
||||||
enable_self_startup: startup = false,
|
enable_self_startup: startup = false,
|
||||||
enable_system_proxy: proxy = false,
|
enable_system_proxy: proxy = false,
|
||||||
} = vergeConfig ?? {};
|
} = vergeConfig ?? {};
|
||||||
@@ -50,42 +49,58 @@ const SettingVerge = ({ onError }: Props) => {
|
|||||||
onCatch={onError}
|
onCatch={onError}
|
||||||
onFormat={onSwitchFormat}
|
onFormat={onSwitchFormat}
|
||||||
onChange={(e) => onChangeData({ theme_mode: e ? "dark" : "light" })}
|
onChange={(e) => onChangeData({ theme_mode: e ? "dark" : "light" })}
|
||||||
onGuard={async (c) => {
|
onGuard={(c) =>
|
||||||
await patchVergeConfig({ theme_mode: c ? "dark" : "light" });
|
patchVergeConfig({ theme_mode: c ? "dark" : "light" })
|
||||||
}}
|
}
|
||||||
>
|
>
|
||||||
<PaletteSwitch edge="end" />
|
<PaletteSwitch edge="end" />
|
||||||
</GuardState>
|
</GuardState>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|
||||||
<SettingItem>
|
<SettingItem>
|
||||||
<ListItemText primary="Self Start" />
|
<ListItemText primary="Theme Blur" />
|
||||||
<GuardState
|
<GuardState
|
||||||
value={startup}
|
value={blur}
|
||||||
valueProps="checked"
|
valueProps="checked"
|
||||||
onCatch={onError}
|
onCatch={onError}
|
||||||
onFormat={onSwitchFormat}
|
onFormat={onSwitchFormat}
|
||||||
onChange={(e) => onChangeData({ enable_self_startup: e })}
|
onChange={(e) => onChangeData({ theme_blur: e })}
|
||||||
onGuard={async (e) => {
|
onGuard={(e) => patchVergeConfig({ theme_blur: e })}
|
||||||
await patchVergeConfig({ enable_self_startup: e });
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Switch edge="end" />
|
<Switch edge="end" />
|
||||||
</GuardState>
|
</GuardState>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|
||||||
<SettingItem>
|
<SettingItem>
|
||||||
<ListItemText primary="System Proxy" />
|
<ListItemText primary="Self Startup" />
|
||||||
|
<GuardState
|
||||||
|
value={startup}
|
||||||
|
valueProps="checked"
|
||||||
|
onCatch={onError}
|
||||||
|
onFormat={onSwitchFormat}
|
||||||
|
onChange={(e) => onChangeData({ enable_self_startup: e })}
|
||||||
|
onGuard={(e) => patchVergeConfig({ enable_self_startup: e })}
|
||||||
|
>
|
||||||
|
<Switch edge="end" />
|
||||||
|
</GuardState>
|
||||||
|
</SettingItem>
|
||||||
|
|
||||||
|
<SettingItem>
|
||||||
|
<ListItemText
|
||||||
|
primary={
|
||||||
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
|
System Proxy
|
||||||
|
<SysproxyTooltip />
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<GuardState
|
<GuardState
|
||||||
value={proxy}
|
value={proxy}
|
||||||
valueProps="checked"
|
valueProps="checked"
|
||||||
onCatch={onError}
|
onCatch={onError}
|
||||||
onFormat={onSwitchFormat}
|
onFormat={onSwitchFormat}
|
||||||
onChange={(e) => onChangeData({ enable_system_proxy: e })}
|
onChange={(e) => onChangeData({ enable_system_proxy: e })}
|
||||||
onGuard={async (e) => {
|
onGuard={(e) => patchVergeConfig({ enable_system_proxy: e })}
|
||||||
await setSysProxy(e);
|
|
||||||
await patchVergeConfig({ enable_system_proxy: e });
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Switch edge="end" />
|
<Switch edge="end" />
|
||||||
</GuardState>
|
</GuardState>
|
||||||
|
|||||||
53
src/components/sysproxy-tooltip.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { InfoRounded } from "@mui/icons-material";
|
||||||
|
import { ClickAwayListener, Tooltip } from "@mui/material";
|
||||||
|
import { getSystemProxy } from "../services/cmds";
|
||||||
|
|
||||||
|
const SysproxyTooltip = () => {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const [info, setInfo] = useState<any>({});
|
||||||
|
|
||||||
|
const onShow = async () => {
|
||||||
|
const data = await getSystemProxy();
|
||||||
|
console.log(data);
|
||||||
|
setInfo(data ?? {});
|
||||||
|
setOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
const timer = setTimeout(() => setOpen(false), 2000);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
|
// todo: add error info
|
||||||
|
const showTitle = (
|
||||||
|
<div>
|
||||||
|
<div>Enable: {(!!info.enable).toString()}</div>
|
||||||
|
<div>Server: {info.server}</div>
|
||||||
|
<div>Bypass: {info.bypass}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ClickAwayListener onClickAway={() => setOpen(false)}>
|
||||||
|
<Tooltip
|
||||||
|
PopperProps={{
|
||||||
|
disablePortal: true,
|
||||||
|
}}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
open={open}
|
||||||
|
disableFocusListener
|
||||||
|
disableHoverListener
|
||||||
|
disableTouchListener
|
||||||
|
placement="top"
|
||||||
|
title={showTitle}
|
||||||
|
arrow
|
||||||
|
>
|
||||||
|
<InfoRounded fontSize="small" onClick={onShow} />
|
||||||
|
</Tooltip>
|
||||||
|
</ClickAwayListener>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SysproxyTooltip;
|
||||||
@@ -3,6 +3,7 @@ import useSWR, { SWRConfig } from "swr";
|
|||||||
import { Route, Routes } from "react-router-dom";
|
import { Route, Routes } from "react-router-dom";
|
||||||
import { useRecoilState } from "recoil";
|
import { useRecoilState } from "recoil";
|
||||||
import {
|
import {
|
||||||
|
alpha,
|
||||||
Button,
|
Button,
|
||||||
createTheme,
|
createTheme,
|
||||||
IconButton,
|
IconButton,
|
||||||
@@ -12,7 +13,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { HorizontalRuleRounded, CloseRounded } from "@mui/icons-material";
|
import { HorizontalRuleRounded, CloseRounded } from "@mui/icons-material";
|
||||||
import { checkUpdate } from "@tauri-apps/api/updater";
|
import { checkUpdate } from "@tauri-apps/api/updater";
|
||||||
import { atomPaletteMode } from "../states/setting";
|
import { atomPaletteMode, atomThemeBlur } from "../states/setting";
|
||||||
import { getVergeConfig, windowDrag, windowHide } from "../services/cmds";
|
import { getVergeConfig, windowDrag, windowHide } from "../services/cmds";
|
||||||
import LogoSvg from "../assets/image/logo.svg";
|
import LogoSvg from "../assets/image/logo.svg";
|
||||||
import LogPage from "./log";
|
import LogPage from "./log";
|
||||||
@@ -54,6 +55,7 @@ const routers = [
|
|||||||
|
|
||||||
const Layout = () => {
|
const Layout = () => {
|
||||||
const [mode, setMode] = useRecoilState(atomPaletteMode);
|
const [mode, setMode] = useRecoilState(atomPaletteMode);
|
||||||
|
const [blur, setBlur] = useRecoilState(atomThemeBlur);
|
||||||
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
||||||
const { data: updateInfo } = useSWR("checkUpdate", checkUpdate, {
|
const { data: updateInfo } = useSWR("checkUpdate", checkUpdate, {
|
||||||
errorRetryCount: 2,
|
errorRetryCount: 2,
|
||||||
@@ -63,8 +65,10 @@ const Layout = () => {
|
|||||||
const [dialogOpen, setDialogOpen] = useState(false);
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setMode(vergeConfig?.theme_mode ?? "light");
|
if (!vergeConfig) return;
|
||||||
}, [vergeConfig?.theme_mode]);
|
setBlur(!!vergeConfig.theme_blur);
|
||||||
|
setMode(vergeConfig.theme_mode ?? "light");
|
||||||
|
}, [vergeConfig]);
|
||||||
|
|
||||||
const theme = useMemo(() => {
|
const theme = useMemo(() => {
|
||||||
// const background = mode === "light" ? "#f5f5f5" : "#000";
|
// const background = mode === "light" ? "#f5f5f5" : "#000";
|
||||||
@@ -89,7 +93,16 @@ const Layout = () => {
|
|||||||
return (
|
return (
|
||||||
<SWRConfig value={{}}>
|
<SWRConfig value={{}}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<Paper square elevation={0} className="layout">
|
<Paper
|
||||||
|
square
|
||||||
|
elevation={0}
|
||||||
|
className="layout"
|
||||||
|
sx={[
|
||||||
|
(theme) => ({
|
||||||
|
bgcolor: alpha(theme.palette.background.paper, blur ? 0.85 : 1),
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
<div className="layout__left">
|
<div className="layout__left">
|
||||||
<div className="the-logo">
|
<div className="the-logo">
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import useSWR from "swr";
|
import useSWR, { useSWRConfig } from "swr";
|
||||||
|
import { useEffect } from "react";
|
||||||
import { Box, List, Paper, Typography } from "@mui/material";
|
import { Box, List, Paper, Typography } from "@mui/material";
|
||||||
import { getProxies } from "../services/api";
|
import { getProxies } from "../services/api";
|
||||||
import ProxyGroup from "../components/proxy-group";
|
import ProxyGroup from "../components/proxy-group";
|
||||||
|
|
||||||
const ProxyPage = () => {
|
const ProxyPage = () => {
|
||||||
|
const { mutate } = useSWRConfig();
|
||||||
const { data: proxiesData } = useSWR("getProxies", getProxies);
|
const { data: proxiesData } = useSWR("getProxies", getProxies);
|
||||||
const { groups = [] } = proxiesData ?? {};
|
const { groups = [] } = proxiesData ?? {};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// fix the empty proxies on the first sight
|
||||||
|
// this bud only show on the build version
|
||||||
|
// call twice to avoid something unknown or the delay of the clash startup
|
||||||
|
setTimeout(() => mutate("getProxies"), 250);
|
||||||
|
setTimeout(() => mutate("getProxies"), 1000);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
|
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
|
||||||
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
|
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
|
||||||
|
|||||||
@@ -56,10 +56,6 @@ export async function patchClashConfig(payload: Partial<ApiType.ConfigData>) {
|
|||||||
return invoke<void>("patch_clash_config", { payload });
|
return invoke<void>("patch_clash_config", { payload });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setSysProxy(enable: boolean) {
|
|
||||||
return invoke<void>("set_sys_proxy", { enable });
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getVergeConfig() {
|
export async function getVergeConfig() {
|
||||||
return invoke<CmdType.VergeConfig>("get_verge_config");
|
return invoke<CmdType.VergeConfig>("get_verge_config");
|
||||||
}
|
}
|
||||||
@@ -67,3 +63,7 @@ export async function getVergeConfig() {
|
|||||||
export async function patchVergeConfig(payload: CmdType.VergeConfig) {
|
export async function patchVergeConfig(payload: CmdType.VergeConfig) {
|
||||||
return invoke<void>("patch_verge_config", { payload });
|
return invoke<void>("patch_verge_config", { payload });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getSystemProxy() {
|
||||||
|
return invoke<any>("get_sys_proxy");
|
||||||
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ export namespace CmdType {
|
|||||||
|
|
||||||
export interface VergeConfig {
|
export interface VergeConfig {
|
||||||
theme_mode?: "light" | "dark";
|
theme_mode?: "light" | "dark";
|
||||||
|
theme_blur?: boolean;
|
||||||
enable_self_startup?: boolean;
|
enable_self_startup?: boolean;
|
||||||
enable_system_proxy?: boolean;
|
enable_system_proxy?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,8 @@ export const atomPaletteMode = atom<"light" | "dark">({
|
|||||||
key: "atomPaletteMode",
|
key: "atomPaletteMode",
|
||||||
default: "light",
|
default: "light",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const atomThemeBlur = atom<boolean>({
|
||||||
|
key: "atomThemeBlur",
|
||||||
|
default: false,
|
||||||
|
});
|
||||||
|
|||||||