Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b9cc90414 | ||
|
|
c1eb539a5c | ||
|
|
e1793f57ef | ||
|
|
dbd09a8743 | ||
|
|
0d189ca617 | ||
|
|
dc9bcc40ee | ||
|
|
4991f7ff39 | ||
|
|
a393b8b122 | ||
|
|
c73b354386 | ||
|
|
392ecee3ff | ||
|
|
bae721c49e | ||
|
|
4e806e21a6 | ||
|
|
ec0fdf83b2 | ||
|
|
cb94d8414f | ||
|
|
8890051c17 | ||
|
|
cf00c9476f | ||
|
|
b2a24c7abd | ||
|
|
732a1f4694 | ||
|
|
4c5aa7084e | ||
|
|
fe1fea671c | ||
|
|
04c754c0ac | ||
|
|
754c22c84e | ||
|
|
629331870b | ||
|
|
78774315cb | ||
|
|
36b9c07928 | ||
|
|
40a818630d | ||
|
|
568511a4cf | ||
|
|
109fb39e09 | ||
|
|
68450d2042 | ||
|
|
8a052bbed6 | ||
|
|
3afbb56640 | ||
|
|
c0ad84a491 | ||
|
|
c72f17605c | ||
|
|
42fbee0cdb | ||
|
|
e9b7ec735f | ||
|
|
743788135f | ||
|
|
8ea3e6fa26 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -53,9 +53,9 @@ jobs:
|
||||
yarn run check
|
||||
|
||||
- name: Tauri build
|
||||
uses: tauri-apps/tauri-action@b9ce5d7dc68082d21d30a60103b0ab8c5ddae3a1
|
||||
uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
|
||||
# enable cache even though failed
|
||||
continue-on-error: true
|
||||
# continue-on-error: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||
@@ -67,6 +67,10 @@ jobs:
|
||||
releaseDraft: false
|
||||
prerelease: true
|
||||
|
||||
- name: Green zip bundle
|
||||
run: |
|
||||
yarn run green
|
||||
|
||||
release-update:
|
||||
needs: release
|
||||
runs-on: macos-11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clash-verge",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.23",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"dev": "tauri dev",
|
||||
@@ -10,6 +10,7 @@
|
||||
"web:build": "tsc && vite build",
|
||||
"web:serve": "vite preview",
|
||||
"check": "node scripts/check.mjs",
|
||||
"green": "node scripts/green.mjs",
|
||||
"publish": "node scripts/publish.mjs",
|
||||
"release": "node scripts/release.mjs",
|
||||
"prepare": "husky install"
|
||||
@@ -19,12 +20,14 @@
|
||||
"@emotion/styled": "^11.8.1",
|
||||
"@mui/icons-material": "^5.4.4",
|
||||
"@mui/material": "^5.4.4",
|
||||
"@tauri-apps/api": "^1.0.0-rc.1",
|
||||
"@tauri-apps/api": "^1.0.0-rc.2",
|
||||
"ahooks": "^3.1.13",
|
||||
"axios": "^0.26.0",
|
||||
"dayjs": "^1.10.8",
|
||||
"i18next": "^21.6.14",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-i18next": "^11.15.6",
|
||||
"react-router-dom": "^6.2.2",
|
||||
"react-virtuoso": "^2.7.0",
|
||||
"recoil": "^0.6.1",
|
||||
@@ -32,7 +35,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/github": "^5.0.0",
|
||||
"@tauri-apps/cli": "^1.0.0-rc.5",
|
||||
"@tauri-apps/cli": "^1.0.0-rc.7",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/js-cookie": "^3.0.1",
|
||||
"@types/react": "^17.0.0",
|
||||
|
||||
@@ -6,6 +6,7 @@ import fetch from "node-fetch";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
const cwd = process.cwd();
|
||||
const FORCE = process.argv.includes("--force");
|
||||
|
||||
const CLASH_URL_PREFIX =
|
||||
"https://github.com/Dreamacro/clash/releases/download/premium/";
|
||||
@@ -19,9 +20,10 @@ function resolveClash() {
|
||||
|
||||
// todo
|
||||
const map = {
|
||||
"win32-x64": "clash-windows-386",
|
||||
"win32-x64": "clash-windows-amd64",
|
||||
"darwin-x64": "clash-darwin-amd64",
|
||||
"darwin-arm64": "clash-darwin-arm64",
|
||||
"linux-x64": "clash-linux-amd64",
|
||||
};
|
||||
|
||||
const name = map[`${platform}-${arch}`];
|
||||
@@ -51,7 +53,7 @@ async function resolveSidecar() {
|
||||
const sidecarPath = path.join(sidecarDir, sidecarFile);
|
||||
|
||||
await fs.mkdirp(sidecarDir);
|
||||
if (await fs.pathExists(sidecarPath)) return;
|
||||
if (!FORCE && (await fs.pathExists(sidecarPath))) return;
|
||||
|
||||
// download sidecar
|
||||
const binInfo = resolveClash();
|
||||
@@ -98,7 +100,7 @@ async function resolveMmdb() {
|
||||
|
||||
const resDir = path.join(cwd, "src-tauri", "resources");
|
||||
const resPath = path.join(resDir, "Country.mmdb");
|
||||
if (await fs.pathExists(resPath)) return;
|
||||
if (!FORCE && (await fs.pathExists(resPath))) return;
|
||||
await fs.mkdirp(resDir);
|
||||
await downloadFile(url, resPath);
|
||||
}
|
||||
|
||||
56
scripts/green.mjs
Normal file
56
scripts/green.mjs
Normal file
@@ -0,0 +1,56 @@
|
||||
import fs from "fs-extra";
|
||||
import path from "path";
|
||||
import AdmZip from "adm-zip";
|
||||
import { createRequire } from "module";
|
||||
import { getOctokit, context } from "@actions/github";
|
||||
|
||||
/// Script for ci
|
||||
/// 打包绿色版/便携版 (only Windows)
|
||||
async function resolveGreen() {
|
||||
if (process.platform !== "win32") return;
|
||||
|
||||
const releaseDir = "./src-tauri/target/release";
|
||||
|
||||
if (!(await fs.pathExists(releaseDir))) {
|
||||
throw new Error("could not found the release dir");
|
||||
}
|
||||
|
||||
const zip = new AdmZip();
|
||||
|
||||
zip.addLocalFile(path.join(releaseDir, "Clash Verge.exe"));
|
||||
zip.addLocalFile(path.join(releaseDir, "clash.exe"));
|
||||
zip.addLocalFolder(path.join(releaseDir, "resources"), "resources");
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const packageJson = require("../package.json");
|
||||
const { version } = packageJson;
|
||||
|
||||
const zipFile = `Clash.Verge_${version}_x64_green.zip`;
|
||||
zip.writeZip(zipFile);
|
||||
|
||||
console.log("[INFO]: create green zip successfully");
|
||||
|
||||
// push release assets
|
||||
if (process.env.GITHUB_TOKEN === undefined) {
|
||||
throw new Error("GITHUB_TOKEN is required");
|
||||
}
|
||||
|
||||
const options = { owner: context.repo.owner, repo: context.repo.repo };
|
||||
const github = getOctokit(process.env.GITHUB_TOKEN);
|
||||
|
||||
const { data: release } = await github.rest.repos.getReleaseByTag({
|
||||
...options,
|
||||
tag: `v${version}`,
|
||||
});
|
||||
|
||||
console.log(release.name);
|
||||
|
||||
await github.rest.repos.uploadReleaseAsset({
|
||||
...options,
|
||||
release_id: release.id,
|
||||
name: zipFile,
|
||||
data: zip.toBuffer(),
|
||||
});
|
||||
}
|
||||
|
||||
resolveGreen().catch(console.error);
|
||||
203
src-tauri/Cargo.lock
generated
203
src-tauri/Cargo.lock
generated
@@ -34,9 +34,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.55"
|
||||
version = "1.0.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
|
||||
checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
@@ -147,9 +147,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.1.0"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d306121baf53310a3fd342d88dc0824f6bbeace68347593658525565abee8"
|
||||
checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
@@ -180,8 +180,8 @@ version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
@@ -317,27 +317,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
|
||||
[[package]]
|
||||
name = "bzip2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0"
|
||||
dependencies = [
|
||||
"bzip2-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bzip2-sys"
|
||||
version = "0.1.11+1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cache-padded"
|
||||
version = "1.2.0"
|
||||
@@ -363,7 +342,7 @@ version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"glib-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
@@ -1173,9 +1152,9 @@ version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413424d9818621fa3cfc8a3a915cdb89a7c3c507d56761b4ec83a9a98e587171"
|
||||
dependencies = [
|
||||
"gio-sys 0.15.6",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"gio-sys 0.15.7",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
@@ -1188,9 +1167,9 @@ checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gio-sys 0.15.6",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"gio-sys 0.15.7",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"pkg-config",
|
||||
@@ -1204,7 +1183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4b7f8c7a84b407aa9b143877e267e848ff34106578b64d1e0a24bf550716178"
|
||||
dependencies = [
|
||||
"gdk-sys",
|
||||
"glib-sys 0.15.6",
|
||||
"glib-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
"x11",
|
||||
@@ -1257,15 +1236,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.15.6"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96efd8a1c00d890f6b45671916e165b5e43ccec61957d443aff6d7e44f62d348"
|
||||
checksum = "bb50e113645fba48bc36c8abaee1fe5e43d353e8763966e29dfe69660514e461"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"gio-sys 0.15.6",
|
||||
"gio-sys 0.15.7",
|
||||
"glib",
|
||||
"libc",
|
||||
"once_cell",
|
||||
@@ -1287,12 +1266,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.15.6"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d0fa5052773f5a56b8ae47dab09d040f5d9ce1311f4f99006e16e9a08269296"
|
||||
checksum = "9cb5dabebbb63c5cf763c9d9cb120280bf1a442cc496e17fd78ff75272d68244"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
"winapi",
|
||||
@@ -1300,9 +1279,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.15.6"
|
||||
version = "0.15.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa570813c504bdf7539a9400180c2dd4b789a819556fb86da7226d7d1b037b49"
|
||||
checksum = "eb53a1102178803a8ea21d383a4332238e42988be61a97819be583bbb405e969"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
@@ -1310,8 +1289,8 @@ dependencies = [
|
||||
"futures-executor",
|
||||
"futures-task",
|
||||
"glib-macros",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
@@ -1345,9 +1324,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.15.6"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4366377bd56697de8aaee24e673c575d2694d72e7756324ded2b0428829a7b8"
|
||||
checksum = "19289e4953dad38c9fea1c5c52cc594f29afc4a70802822ef382dca356b27bfd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
@@ -1385,11 +1364,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.15.5"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df6859463843c20cf3837e3a9069b6ab2051aeeadf4c899d33344f4aea83189a"
|
||||
checksum = "db362c9cb92af37a8d58cedb3464ff307485dcc463e46b298f1da1bda60f78b0"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"glib-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
@@ -1427,9 +1406,9 @@ dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk-sys",
|
||||
"gio-sys 0.15.6",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"gio-sys 0.15.7",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps 6.0.2",
|
||||
@@ -1710,9 +1689,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.3.1"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"
|
||||
checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
@@ -1752,8 +1731,8 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "905fbb87419c5cde6e3269537e4ea7d46431f3008c5d057e915ef3f115e7793c"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 5.0.0",
|
||||
]
|
||||
@@ -2209,18 +2188,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
|
||||
checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
|
||||
dependencies = [
|
||||
"num_enum_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum_derive"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
|
||||
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.1.3",
|
||||
"proc-macro2",
|
||||
@@ -2235,6 +2214,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
dependencies = [
|
||||
"malloc_buf",
|
||||
"objc_exception",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2248,6 +2228,15 @@ dependencies = [
|
||||
"objc_id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_id"
|
||||
version = "0.1.1"
|
||||
@@ -2259,9 +2248,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.9.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
@@ -2271,9 +2260,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a82915836ef43159bb6a3c64d884c42329ccd0b8afdca737cf1e3dd701709dc"
|
||||
checksum = "9213e7b66aa06a7722828ee2980c1adff22a3922b582baaa1e62e30ca2a6c018"
|
||||
dependencies = [
|
||||
"pathdiff",
|
||||
"winapi",
|
||||
@@ -2343,9 +2332,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.15.6"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78c7420fc01a390ec200da7395b64d705f5d82fe03e5d0708aee422c46538be7"
|
||||
checksum = "a159678be05876e40e1bb4e93db9c9e2f86986fac010b3630feab1273f83b605"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"glib",
|
||||
@@ -2360,8 +2349,8 @@ version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7022c2fb88cd2d9d55e1a708a8c53a3ae8678234c4a54bf623400aeb7f31fac2"
|
||||
dependencies = [
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"libc",
|
||||
"system-deps 6.0.2",
|
||||
]
|
||||
@@ -2853,9 +2842,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -2931,8 +2920,8 @@ dependencies = [
|
||||
"ashpd",
|
||||
"block",
|
||||
"dispatch",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"gtk-sys",
|
||||
"js-sys",
|
||||
"lazy_static",
|
||||
@@ -3293,9 +3282,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e"
|
||||
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
@@ -3473,9 +3462,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tao"
|
||||
version = "0.6.3"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c4c62fc16d698750c5c918088c8134c63e8661e65efc608fe614236c59462f4"
|
||||
checksum = "6a01ed3d6141768e0e36bfe3910f24511022c3dfb977810b00c518d507d4ead4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
@@ -3491,7 +3480,7 @@ dependencies = [
|
||||
"gdkx11-sys",
|
||||
"gio",
|
||||
"glib",
|
||||
"glib-sys 0.15.6",
|
||||
"glib-sys 0.15.7",
|
||||
"gtk",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
@@ -3538,9 +3527,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "1.0.0-rc.3"
|
||||
version = "1.0.0-rc.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb0c4a4ffd1f9b02cc3e974ce902f8132fb3d08ec6cce4ca193f97d921f5bce4"
|
||||
checksum = "1112a78b3de89c41e01b671d62f24038d324c6cb61708896ee16f533b655c82e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"attohttpc",
|
||||
@@ -3558,6 +3547,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
"ignore",
|
||||
"memchr",
|
||||
"minisign-verify",
|
||||
"once_cell",
|
||||
"open",
|
||||
@@ -3584,14 +3574,15 @@ dependencies = [
|
||||
"tokio",
|
||||
"url",
|
||||
"uuid",
|
||||
"windows",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "1.0.0-rc.3"
|
||||
version = "1.0.0-rc.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "855e47d8cfb2219fc14d2eed2c09bfb35f9ecd71a40ca2084aeeee2d23e0b60d"
|
||||
checksum = "d7e31905edc1b40f369beccbbfb30b2e44c2f2bb1ffc06a3778d844af4a81da8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
@@ -3602,12 +3593,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "1.0.0-rc.2"
|
||||
version = "1.0.0-rc.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eef4656d174ba982198266da0c016573fe6c7c760e4290f05c8c384fe180007e"
|
||||
checksum = "fbcba93e945eb73ee232621763a1295247d0155867bb72e815ab107a10a7cf97"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"blake3",
|
||||
"ico",
|
||||
"png 0.16.8",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
@@ -3623,9 +3616,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "1.0.0-rc.2"
|
||||
version = "1.0.0-rc.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0993f5a867e321d26200b2d6394cdf482bd6cc5a0e4691bcabf811544f51cd4"
|
||||
checksum = "ed251657dcdd21922e0146af5f8a3b9ccf92707d4a42add615c250ff92a6838d"
|
||||
dependencies = [
|
||||
"heck 0.4.0",
|
||||
"proc-macro2",
|
||||
@@ -3637,9 +3630,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "851cd65e2c9df4dd70a4f9e115fb2441ac89f1c80df79de0c15a448b4acd7768"
|
||||
checksum = "ae0442d935c2d168541d74be51c4d4f176b1c00ee6bf052f07c1aa5f688ba497"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
@@ -3656,14 +3649,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0184f95e065fb80afadf53f0a5f87a75af2da774d0524fe8cb2976fbec4a0bf2"
|
||||
checksum = "643aaa56237304264804dbf34748b21042eadda71d2e964bced1651c19cc0314"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"ico",
|
||||
"infer",
|
||||
"png 0.16.8",
|
||||
"tauri-runtime",
|
||||
"tauri-utils",
|
||||
"uuid",
|
||||
@@ -3674,9 +3664,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "1.0.0-rc.2"
|
||||
version = "1.0.0-rc.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ad38ad698838886bf22ecb91c4b3d1ce178fdff7901ac7bff370103a4f51e59"
|
||||
checksum = "21f11483d205c77d1ec398e80566485101696335983e69832cc6c41ab1e07266"
|
||||
dependencies = [
|
||||
"ctor",
|
||||
"glob",
|
||||
@@ -4280,10 +4270,10 @@ dependencies = [
|
||||
"gdk",
|
||||
"gdk-sys",
|
||||
"gio",
|
||||
"gio-sys 0.15.6",
|
||||
"gio-sys 0.15.7",
|
||||
"glib",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"gtk",
|
||||
"gtk-sys",
|
||||
"javascriptcore-rs",
|
||||
@@ -4303,9 +4293,9 @@ dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk-sys",
|
||||
"gio-sys 0.15.6",
|
||||
"glib-sys 0.15.6",
|
||||
"gobject-sys 0.15.5",
|
||||
"gio-sys 0.15.7",
|
||||
"glib-sys 0.15.7",
|
||||
"gobject-sys 0.15.7",
|
||||
"gtk-sys",
|
||||
"javascriptcore-rs-sys",
|
||||
"libc",
|
||||
@@ -4411,8 +4401,8 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "window-shadows"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/tauri-apps/window-shadows#72de826498573de6bed48038bbc74a3dbde7460e"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/tauri-apps/window-shadows#71c656abf892313e0a91d56ddf8bef5d80bd2a22"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"objc",
|
||||
@@ -4423,7 +4413,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "window-vibrancy"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/tauri-apps/window-vibrancy#3fd5be20535ec9b595e893b75dc74b6725664852"
|
||||
source = "git+https://github.com/tauri-apps/window-vibrancy#c91cd362e0758fe93cf41a740d2e00a668523fe8"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"objc",
|
||||
@@ -4768,11 +4758,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bzip2",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"thiserror",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -10,7 +10,7 @@ edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.0-rc.3", features = [] }
|
||||
tauri-build = { version = "1.0.0-rc.4", features = [] }
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
@@ -21,7 +21,7 @@ chrono = "0.4.19"
|
||||
serde_json = "1.0"
|
||||
serde_yaml = "0.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.0-rc.3", features = ["shell-all", "system-tray", "updater", "window-all"] }
|
||||
tauri = { version = "1.0.0-rc.4", features = ["shell-all", "system-tray", "updater", "window-all"] }
|
||||
window-shadows = { git = "https://github.com/tauri-apps/window-shadows" }
|
||||
window-vibrancy = { git = "https://github.com/tauri-apps/window-vibrancy" }
|
||||
|
||||
|
||||
BIN
src-tauri/icons/icon-shrink.png
Normal file
BIN
src-tauri/icons/icon-shrink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
core::{ClashInfo, PrfItem, Profiles, VergeConfig},
|
||||
core::{ClashInfo, PrfItem, PrfOption, Profiles, VergeConfig},
|
||||
states::{ClashState, ProfilesState, VergeState},
|
||||
utils::{dirs, sysopt::SysProxyConfig},
|
||||
};
|
||||
@@ -28,10 +28,10 @@ pub fn sync_profiles(profiles_state: State<'_, ProfilesState>) -> Result<(), Str
|
||||
#[tauri::command]
|
||||
pub async fn import_profile(
|
||||
url: String,
|
||||
with_proxy: bool,
|
||||
option: Option<PrfOption>,
|
||||
profiles_state: State<'_, ProfilesState>,
|
||||
) -> Result<(), String> {
|
||||
let item = wrap_err!(PrfItem::from_url(&url, None, None, with_proxy).await)?;
|
||||
let item = wrap_err!(PrfItem::from_url(&url, None, None, option).await)?;
|
||||
|
||||
let mut profiles = profiles_state.0.lock().unwrap();
|
||||
wrap_err!(profiles.append_item(item))
|
||||
@@ -55,23 +55,31 @@ pub async fn create_profile(
|
||||
#[tauri::command]
|
||||
pub async fn update_profile(
|
||||
index: String,
|
||||
with_proxy: bool,
|
||||
option: Option<PrfOption>,
|
||||
clash_state: State<'_, ClashState>,
|
||||
profiles_state: State<'_, ProfilesState>,
|
||||
) -> Result<(), String> {
|
||||
let url = {
|
||||
let (url, opt) = {
|
||||
// must release the lock here
|
||||
let profiles = profiles_state.0.lock().unwrap();
|
||||
let item = wrap_err!(profiles.get_item(&index))?;
|
||||
|
||||
// check the profile type
|
||||
if let Some(typ) = item.itype.as_ref() {
|
||||
if *typ != "remote" {
|
||||
ret_err!(format!("could not update the `{typ}` profile"));
|
||||
}
|
||||
}
|
||||
|
||||
if item.url.is_none() {
|
||||
ret_err!("failed to get the item url");
|
||||
}
|
||||
|
||||
item.url.clone().unwrap()
|
||||
(item.url.clone().unwrap(), item.option.clone())
|
||||
};
|
||||
|
||||
let item = wrap_err!(PrfItem::from_url(&url, None, None, with_proxy).await)?;
|
||||
let fetch_opt = PrfOption::merge(opt, option);
|
||||
let item = wrap_err!(PrfItem::from_url(&url, None, None, fetch_opt).await)?;
|
||||
|
||||
let mut profiles = profiles_state.0.lock().unwrap();
|
||||
wrap_err!(profiles.update_item(index.clone(), item))?;
|
||||
@@ -181,21 +189,23 @@ pub fn view_profile(index: String, profiles_state: State<'_, ProfilesState>) ->
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
return match Command::new(code)
|
||||
if let Err(err) = Command::new(code)
|
||||
.creation_flags(0x08000000)
|
||||
.arg(path)
|
||||
.spawn()
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("failed to open file by VScode".into()),
|
||||
};
|
||||
log::error!("{err}");
|
||||
return Err("failed to open file by VScode".into());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
return match Command::new(code).arg(path).spawn() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err("failed to open file by VScode".into()),
|
||||
};
|
||||
if let Err(err) = Command::new(code).arg(path).spawn() {
|
||||
log::error!("{err}");
|
||||
return Err("failed to open file by VScode".into());
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
open_path_cmd(path, "failed to open file by `open`")
|
||||
@@ -311,25 +321,54 @@ pub fn open_logs_dir() -> Result<(), String> {
|
||||
open_path_cmd(log_dir, "failed to open logs dir")
|
||||
}
|
||||
|
||||
/// get open/explorer command
|
||||
fn open_path_cmd(dir: PathBuf, err_str: &str) -> Result<(), String> {
|
||||
/// use the os default open command to open file or dir
|
||||
fn open_path_cmd(path: PathBuf, err_str: &str) -> Result<(), String> {
|
||||
let result;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
match Command::new("explorer")
|
||||
result = Command::new("explorer")
|
||||
.creation_flags(0x08000000)
|
||||
.arg(dir)
|
||||
.spawn()
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(err_str.into()),
|
||||
.arg(&path)
|
||||
.spawn();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
result = Command::new("open").arg(&path).spawn();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
result = Command::new("xdg-open").arg(&path).spawn();
|
||||
}
|
||||
|
||||
match result {
|
||||
Ok(child) => match child.wait_with_output() {
|
||||
Ok(out) => {
|
||||
if let Some(code) = out.status.code() {
|
||||
if code != 0 {
|
||||
log::error!(
|
||||
"failed to open path {:?} for {} (code {code})",
|
||||
&path,
|
||||
String::from_utf8_lossy(&out.stderr),
|
||||
);
|
||||
return Err(err_str.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to open path {:?} for {err}", &path);
|
||||
return Err(err_str.into());
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
log::error!("failed to open path {:?} for {err}", &path);
|
||||
return Err(err_str.into());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
match Command::new("open").arg(dir).spawn() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(err_str.into()),
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -95,7 +95,18 @@ impl Clash {
|
||||
|
||||
let server = match clash_config.get(&key_server) {
|
||||
Some(value) => match value {
|
||||
Value::String(val_str) => Some(val_str.clone()),
|
||||
Value::String(val_str) => {
|
||||
// `external-controller` could be
|
||||
// "127.0.0.1:9090" or ":9090"
|
||||
// Todo: maybe it could support single port
|
||||
let server = val_str.clone();
|
||||
let server = match server.starts_with(":") {
|
||||
true => format!("127.0.0.1{server}"),
|
||||
false => server,
|
||||
};
|
||||
|
||||
Some(server)
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
@@ -253,7 +264,7 @@ impl Clash {
|
||||
/// activate the profile
|
||||
/// generate a new profile to the temp_dir
|
||||
/// then put the path to the clash core
|
||||
fn _activate(info: ClashInfo, config: Mapping) -> Result<()> {
|
||||
fn _activate(info: ClashInfo, config: Mapping, window: Option<Window>) -> Result<()> {
|
||||
let temp_path = dirs::profiles_temp_path();
|
||||
config::save_yaml(temp_path.clone(), &config, Some("# Clash Verge Temp File"))?;
|
||||
|
||||
@@ -283,6 +294,12 @@ impl Clash {
|
||||
if resp.status() != 204 {
|
||||
log::error!("failed to activate clash for status \"{}\"", resp.status());
|
||||
}
|
||||
|
||||
// emit the window to update something
|
||||
if let Some(window) = window {
|
||||
window.emit("verge://refresh-clash-config", "yes").unwrap();
|
||||
}
|
||||
|
||||
// do not retry
|
||||
break;
|
||||
}
|
||||
@@ -314,21 +331,47 @@ impl Clash {
|
||||
|
||||
// generate the payload
|
||||
let payload = profiles.gen_enhanced(event_name.clone())?;
|
||||
let window = self.window.clone();
|
||||
|
||||
win.once(&event_name, move |event| {
|
||||
if let Some(result) = event.payload() {
|
||||
let result: PrfEnhancedResult = serde_json::from_str(result).unwrap();
|
||||
|
||||
if let Some(data) = result.data {
|
||||
// all of these can not be revised by script
|
||||
// http/https/socks port should be under control
|
||||
let not_allow = vec![
|
||||
"port",
|
||||
"socks-port",
|
||||
"mixed-port",
|
||||
"allow-lan",
|
||||
"mode",
|
||||
"external-controller",
|
||||
"secret",
|
||||
"log-level",
|
||||
];
|
||||
|
||||
for (key, value) in data.into_iter() {
|
||||
config.insert(key, value);
|
||||
key.as_str().map(|key_str| {
|
||||
// change to lowercase
|
||||
let mut key_str = String::from(key_str);
|
||||
key_str.make_ascii_lowercase();
|
||||
|
||||
// filter
|
||||
if !not_allow.contains(&&*key_str) {
|
||||
config.insert(Value::String(key_str), value);
|
||||
}
|
||||
});
|
||||
}
|
||||
Self::_activate(info, config).unwrap();
|
||||
|
||||
log::info!("profile enhanced status {}", result.status);
|
||||
|
||||
Self::_activate(info, config, window).unwrap();
|
||||
}
|
||||
|
||||
log::info!("profile enhanced status {}", result.status);
|
||||
|
||||
result.error.map(|error| log::error!("{error}"));
|
||||
if let Some(error) = result.error {
|
||||
log::error!("{error}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -354,7 +397,7 @@ impl Clash {
|
||||
config.insert(key, value);
|
||||
}
|
||||
|
||||
Self::_activate(info, config)?;
|
||||
Self::_activate(info, config, self.window.clone())?;
|
||||
self.activate_enhanced(profiles, delay)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,13 +31,17 @@ pub struct PrfItem {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub selected: Option<Vec<PrfSelected>>,
|
||||
|
||||
/// user info
|
||||
/// subscription user info
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub extra: Option<PrfExtra>,
|
||||
|
||||
/// updated time
|
||||
pub updated: Option<usize>,
|
||||
|
||||
/// some options of the item
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub option: Option<PrfOption>,
|
||||
|
||||
/// the file data
|
||||
#[serde(skip)]
|
||||
pub file_data: Option<String>,
|
||||
@@ -57,6 +61,43 @@ pub struct PrfExtra {
|
||||
pub expire: usize,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PrfOption {
|
||||
/// for `remote` profile's http request
|
||||
/// see issue #13
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub user_agent: Option<String>,
|
||||
|
||||
/// for `remote` profile
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub with_proxy: Option<bool>,
|
||||
}
|
||||
|
||||
impl PrfOption {
|
||||
pub fn merge(one: Option<Self>, other: Option<Self>) -> Option<Self> {
|
||||
if one.is_some() && other.is_some() {
|
||||
let mut one = one.unwrap();
|
||||
let other = other.unwrap();
|
||||
|
||||
if let Some(val) = other.user_agent {
|
||||
one.user_agent = Some(val);
|
||||
}
|
||||
|
||||
if let Some(val) = other.with_proxy {
|
||||
one.with_proxy = Some(val);
|
||||
}
|
||||
|
||||
return Some(one);
|
||||
}
|
||||
|
||||
if one.is_none() {
|
||||
return other;
|
||||
}
|
||||
|
||||
return one;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PrfItem {
|
||||
fn default() -> Self {
|
||||
PrfItem {
|
||||
@@ -69,6 +110,7 @@ impl Default for PrfItem {
|
||||
selected: None,
|
||||
extra: None,
|
||||
updated: None,
|
||||
option: None,
|
||||
file_data: None,
|
||||
}
|
||||
}
|
||||
@@ -90,7 +132,7 @@ impl PrfItem {
|
||||
let url = item.url.as_ref().unwrap().as_str();
|
||||
let name = item.name;
|
||||
let desc = item.desc;
|
||||
PrfItem::from_url(url, name, desc, false).await
|
||||
PrfItem::from_url(url, name, desc, item.option).await
|
||||
}
|
||||
"local" => {
|
||||
let name = item.name.unwrap_or("Local File".into());
|
||||
@@ -126,6 +168,7 @@ impl PrfItem {
|
||||
url: None,
|
||||
selected: None,
|
||||
extra: None,
|
||||
option: None,
|
||||
updated: Some(help::get_now()),
|
||||
file_data: Some(tmpl::ITEM_LOCAL.into()),
|
||||
})
|
||||
@@ -137,13 +180,25 @@ impl PrfItem {
|
||||
url: &str,
|
||||
name: Option<String>,
|
||||
desc: Option<String>,
|
||||
with_proxy: bool,
|
||||
option: Option<PrfOption>,
|
||||
) -> Result<PrfItem> {
|
||||
let with_proxy = match option.as_ref() {
|
||||
Some(opt) => opt.with_proxy.unwrap_or(false),
|
||||
None => false,
|
||||
};
|
||||
let user_agent = match option.as_ref() {
|
||||
Some(opt) => opt.user_agent.clone(),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let mut builder = reqwest::ClientBuilder::new();
|
||||
|
||||
if !with_proxy {
|
||||
builder = builder.no_proxy();
|
||||
}
|
||||
if let Some(user_agent) = user_agent {
|
||||
builder = builder.user_agent(user_agent);
|
||||
}
|
||||
|
||||
let resp = builder.build()?.get(url).send().await?;
|
||||
let header = resp.headers();
|
||||
@@ -177,6 +232,7 @@ impl PrfItem {
|
||||
url: Some(url.into()),
|
||||
selected: None,
|
||||
extra,
|
||||
option,
|
||||
updated: Some(help::get_now()),
|
||||
file_data: Some(data),
|
||||
})
|
||||
@@ -197,6 +253,7 @@ impl PrfItem {
|
||||
url: None,
|
||||
selected: None,
|
||||
extra: None,
|
||||
option: None,
|
||||
updated: Some(help::get_now()),
|
||||
file_data: Some(tmpl::ITEM_MERGE.into()),
|
||||
})
|
||||
@@ -217,6 +274,7 @@ impl PrfItem {
|
||||
url: None,
|
||||
selected: None,
|
||||
extra: None,
|
||||
option: None,
|
||||
updated: Some(help::get_now()),
|
||||
file_data: Some(tmpl::ITEM_SCRIPT.into()),
|
||||
})
|
||||
@@ -380,8 +438,8 @@ impl Profiles {
|
||||
patch!(each, item, url);
|
||||
patch!(each, item, selected);
|
||||
patch!(each, item, extra);
|
||||
|
||||
each.updated = Some(help::get_now());
|
||||
patch!(each, item, updated);
|
||||
patch!(each, item, option);
|
||||
|
||||
self.items = Some(items);
|
||||
return self.save_file();
|
||||
@@ -508,13 +566,17 @@ impl Profiles {
|
||||
"rules",
|
||||
];
|
||||
|
||||
valid_keys.iter().for_each(|key| {
|
||||
let key = Value::String(key.to_string());
|
||||
if def_config.contains_key(&key) {
|
||||
let value = def_config[&key].clone();
|
||||
new_config.insert(key, value);
|
||||
}
|
||||
});
|
||||
for (key, value) in def_config.into_iter() {
|
||||
key.as_str().map(|key_str| {
|
||||
// change to lowercase
|
||||
let mut key_str = String::from(key_str);
|
||||
key_str.make_ascii_lowercase();
|
||||
|
||||
if valid_keys.contains(&&*key_str) {
|
||||
new_config.insert(Value::String(key_str), value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Ok(new_config);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::log_if_err;
|
||||
use crate::{
|
||||
core::Clash,
|
||||
log_if_err,
|
||||
utils::{config, dirs, sysopt::SysProxyConfig},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
@@ -12,6 +12,9 @@ use tauri::{async_runtime::Mutex, utils::platform::current_exe};
|
||||
/// ### `verge.yaml` schema
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct VergeConfig {
|
||||
// i18n
|
||||
pub language: Option<String>,
|
||||
|
||||
/// `light` or `dark`
|
||||
pub theme_mode: Option<String>,
|
||||
|
||||
@@ -188,6 +191,9 @@ impl Verge {
|
||||
/// so call the save_file at the end is savely
|
||||
pub fn patch_config(&mut self, patch: VergeConfig) -> Result<()> {
|
||||
// only change it
|
||||
if patch.language.is_some() {
|
||||
self.config.language = patch.language;
|
||||
}
|
||||
if patch.theme_mode.is_some() {
|
||||
self.config.theme_mode = patch.theme_mode;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,8 @@ fn main() -> std::io::Result<()> {
|
||||
let profiles_state = app_handle.state::<states::ProfilesState>();
|
||||
let mut clash = clash_state.0.lock().unwrap();
|
||||
let mut profiles = profiles_state.0.lock().unwrap();
|
||||
match clash.restart_sidecar(&mut profiles) {
|
||||
Ok(_) => {
|
||||
let window = app_handle.get_window("main").unwrap();
|
||||
window.emit("restart_clash", "yes").unwrap();
|
||||
}
|
||||
Err(err) => log::error!("{}", err),
|
||||
}
|
||||
|
||||
crate::log_if_err!(clash.restart_sidecar(&mut profiles));
|
||||
}
|
||||
"quit" => {
|
||||
resolve::resolve_reset(app_handle);
|
||||
|
||||
@@ -68,7 +68,7 @@ macro_rules! wrap_err {
|
||||
/// return the string literal error
|
||||
#[macro_export]
|
||||
macro_rules! ret_err {
|
||||
($str: literal) => {
|
||||
($str: expr) => {
|
||||
return Err($str.into())
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,13 +67,13 @@ pub fn init_app(package_info: &PackageInfo) {
|
||||
let res_dir = dirs::app_resources_dir(package_info);
|
||||
|
||||
if !app_dir.exists() {
|
||||
fs::create_dir(&app_dir).unwrap();
|
||||
fs::create_dir_all(&app_dir).unwrap();
|
||||
}
|
||||
if !log_dir.exists() {
|
||||
fs::create_dir(&log_dir).unwrap();
|
||||
fs::create_dir_all(&log_dir).unwrap();
|
||||
}
|
||||
if !profiles_dir.exists() {
|
||||
fs::create_dir(&profiles_dir).unwrap();
|
||||
fs::create_dir_all(&profiles_dir).unwrap();
|
||||
}
|
||||
|
||||
init_log(&log_dir);
|
||||
|
||||
@@ -61,7 +61,7 @@ fn resolve_window(app: &App) {
|
||||
|
||||
window.set_decorations(false).unwrap();
|
||||
set_shadow(&window, true).unwrap();
|
||||
apply_blur(&window).unwrap();
|
||||
apply_blur(&window, None).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
static DEFAULT_BYPASS: &str = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*;<local>";
|
||||
#[cfg(target_os = "linux")]
|
||||
static DEFAULT_BYPASS: &str = "localhost,127.0.0.1/8,::1";
|
||||
#[cfg(target_os = "macos")]
|
||||
static DEFAULT_BYPASS: &str =
|
||||
"192.168.0.0/16\n10.0.0.0/8\n172.16.0.0/12\n127.0.0.1\nlocalhost\n*.local\ntimestamp.apple.com\n";
|
||||
@@ -34,10 +36,12 @@ impl SysProxyConfig {
|
||||
bypass: bypass.unwrap_or(DEFAULT_BYPASS.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
#[cfg(target_os = "windows")]
|
||||
impl SysProxyConfig {
|
||||
/// Get the windows system proxy config
|
||||
pub fn get_sys() -> io::Result<Self> {
|
||||
pub fn get_sys() -> Result<Self> {
|
||||
use winreg::enums::*;
|
||||
use winreg::RegKey;
|
||||
|
||||
@@ -54,9 +58,30 @@ impl SysProxyConfig {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
/// Set the windows system proxy config
|
||||
pub fn set_sys(&self) -> 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\\Internet Settings",
|
||||
KEY_SET_VALUE,
|
||||
)?;
|
||||
|
||||
let enable: u32 = if self.enable { 1u32 } else { 0u32 };
|
||||
|
||||
cur_var.set_value("ProxyEnable", &enable)?;
|
||||
cur_var.set_value("ProxyServer", &self.server)?;
|
||||
cur_var.set_value("ProxyOverride", &self.bypass)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
impl SysProxyConfig {
|
||||
/// Get the macos system proxy config
|
||||
pub fn get_sys() -> io::Result<Self> {
|
||||
pub fn get_sys() -> Result<Self> {
|
||||
use std::process::Command;
|
||||
|
||||
let http = macproxy::get_proxy(&["-getwebproxy", MACOS_SERVICE])?;
|
||||
@@ -82,63 +107,59 @@ impl SysProxyConfig {
|
||||
let bypass_output = Command::new("networksetup")
|
||||
.args(["-getproxybypassdomains", MACOS_SERVICE])
|
||||
.output()?;
|
||||
let bypass = std::str::from_utf8(&bypass_output.stdout).unwrap_or(DEFAULT_BYPASS);
|
||||
|
||||
// change the format to xxx,xxx
|
||||
let bypass = std::str::from_utf8(&bypass_output.stdout)
|
||||
.unwrap_or(DEFAULT_BYPASS)
|
||||
.to_string()
|
||||
.split('\n')
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
|
||||
Ok(SysProxyConfig {
|
||||
enable,
|
||||
server,
|
||||
bypass: bypass.into(),
|
||||
bypass,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
/// Set the windows system proxy config
|
||||
pub fn set_sys(&self) -> 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\\Internet Settings",
|
||||
KEY_SET_VALUE,
|
||||
)?;
|
||||
|
||||
let enable: u32 = if self.enable { 1u32 } else { 0u32 };
|
||||
|
||||
cur_var.set_value("ProxyEnable", &enable)?;
|
||||
cur_var.set_value("ProxyServer", &self.server)?;
|
||||
cur_var.set_value("ProxyOverride", &self.bypass)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
/// Set the macos system proxy config
|
||||
pub fn set_sys(&self) -> io::Result<()> {
|
||||
pub fn set_sys(&self) -> Result<()> {
|
||||
use std::process::Command;
|
||||
|
||||
let enable = self.enable;
|
||||
let server = self.server.as_str();
|
||||
let bypass = self.bypass.clone();
|
||||
macproxy::set_proxy("-setwebproxy", MACOS_SERVICE, enable, server)?;
|
||||
macproxy::set_proxy("-setsecurewebproxy", MACOS_SERVICE, enable, server)?;
|
||||
macproxy::set_proxy("-setsocksfirewallproxy", MACOS_SERVICE, enable, server)
|
||||
macproxy::set_proxy("-setsocksfirewallproxy", MACOS_SERVICE, enable, server)?;
|
||||
|
||||
let domains = bypass.split(",").collect::<Vec<_>>();
|
||||
Command::new("networksetup")
|
||||
.args([["-setproxybypassdomains", MACOS_SERVICE].to_vec(), domains].concat())
|
||||
.status()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macproxy {
|
||||
use super::*;
|
||||
use anyhow::bail;
|
||||
use std::process::Command;
|
||||
|
||||
/// use networksetup
|
||||
/// get the target proxy config
|
||||
pub(super) fn get_proxy(args: &[&str; 2]) -> io::Result<(String, String)> {
|
||||
pub(super) fn get_proxy(args: &[&str; 2]) -> Result<(String, String)> {
|
||||
let output = Command::new("networksetup").args(args).output()?;
|
||||
match std::str::from_utf8(&output.stdout) {
|
||||
Ok(stdout) => {
|
||||
let enable = parse(stdout, "Enabled:");
|
||||
let server = parse(stdout, "Server:");
|
||||
let port = parse(stdout, "Port:");
|
||||
let server = format!("{}:{}", server, port);
|
||||
Ok((enable.into(), server))
|
||||
}
|
||||
Err(_) => Err(io::Error::from_raw_os_error(1)),
|
||||
}
|
||||
|
||||
let stdout = std::str::from_utf8(&output.stdout)?;
|
||||
let enable = parse(stdout, "Enabled:");
|
||||
let server = parse(stdout, "Server:");
|
||||
let port = parse(stdout, "Port:");
|
||||
let server = format!("{server}:{port}");
|
||||
Ok((enable.into(), server))
|
||||
}
|
||||
|
||||
/// use networksetup
|
||||
@@ -148,17 +169,17 @@ mod macproxy {
|
||||
device: &str,
|
||||
enable: bool,
|
||||
server: &str,
|
||||
) -> io::Result<()> {
|
||||
) -> Result<()> {
|
||||
let mut split = server.split(":");
|
||||
let domain = split.next();
|
||||
let host = split.next();
|
||||
let port = split.next();
|
||||
|
||||
// can not parse the field
|
||||
if domain.is_none() || port.is_none() {
|
||||
return Err(io::Error::from_raw_os_error(1));
|
||||
if host.is_none() || port.is_none() {
|
||||
bail!("failed to parse the server into host:port");
|
||||
}
|
||||
|
||||
let args = vec![target, device, domain.unwrap(), port.unwrap()];
|
||||
let args = vec![target, device, host.unwrap(), port.unwrap()];
|
||||
Command::new("networksetup").args(&args).status()?;
|
||||
|
||||
let target_state = String::from(target) + "state";
|
||||
@@ -169,7 +190,7 @@ mod macproxy {
|
||||
}
|
||||
|
||||
/// parse the networksetup output
|
||||
pub(super) fn parse<'a>(target: &'a str, key: &'a str) -> &'a str {
|
||||
fn parse<'a>(target: &'a str, key: &'a str) -> &'a str {
|
||||
match target.find(key) {
|
||||
Some(idx) => {
|
||||
let idx = idx + key.len();
|
||||
@@ -209,3 +230,137 @@ mod macproxy {
|
||||
dbg!(sysproxy.set_sys().unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Linux Desktop System Proxy Supports
|
||||
/// by using `gsettings`
|
||||
#[cfg(target_os = "linux")]
|
||||
impl SysProxyConfig {
|
||||
/// Get the system proxy config [http/https/socks]
|
||||
pub fn get_sys() -> Result<Self> {
|
||||
use std::process::Command;
|
||||
|
||||
let schema = "org.gnome.system.proxy";
|
||||
|
||||
// get enable
|
||||
let mode = Command::new("gsettings")
|
||||
.args(["get", schema, "mode"])
|
||||
.output()?;
|
||||
let mode = std::str::from_utf8(&mode.stdout)?;
|
||||
let enable = mode == "manual";
|
||||
|
||||
// get bypass
|
||||
// Todo: parse the ignore-hosts
|
||||
// ['aaa', 'bbb'] -> aaa,bbb
|
||||
let ignore = Command::new("gsettings")
|
||||
.args(["get", schema, "ignore-hosts"])
|
||||
.output()?;
|
||||
let ignore = std::str::from_utf8(&ignore.stdout)?;
|
||||
let bypass = ignore.to_string();
|
||||
|
||||
let http = Self::get_proxy("http")?;
|
||||
let https = Self::get_proxy("https")?;
|
||||
let socks = Self::get_proxy("socks")?;
|
||||
|
||||
let mut server = "".into();
|
||||
|
||||
if socks.len() > 0 {
|
||||
server = socks;
|
||||
}
|
||||
if https.len() > 0 {
|
||||
server = https;
|
||||
}
|
||||
if http.len() > 0 {
|
||||
server = http;
|
||||
}
|
||||
|
||||
Ok(SysProxyConfig {
|
||||
enable,
|
||||
server,
|
||||
bypass,
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the system proxy config [http/https/socks]
|
||||
pub fn set_sys(&self) -> Result<()> {
|
||||
use anyhow::bail;
|
||||
use std::process::Command;
|
||||
|
||||
let enable = self.enable;
|
||||
let server = self.server.as_str();
|
||||
let bypass = self.bypass.clone();
|
||||
let schema = "org.gnome.system.proxy";
|
||||
|
||||
if enable {
|
||||
let mut split = server.split(":");
|
||||
let host = split.next();
|
||||
let port = split.next();
|
||||
|
||||
if port.is_none() {
|
||||
bail!("failed to parse the port");
|
||||
}
|
||||
|
||||
let host = format!("'{}'", host.unwrap_or("127.0.0.1"));
|
||||
let host = host.as_str();
|
||||
let port = port.unwrap();
|
||||
|
||||
let http = format!("{schema}.http");
|
||||
Command::new("gsettings")
|
||||
.args(["set", http.as_str(), "host", host])
|
||||
.status()?;
|
||||
Command::new("gsettings")
|
||||
.args(["set", http.as_str(), "port", port])
|
||||
.status()?;
|
||||
|
||||
let https = format!("{schema}.https");
|
||||
Command::new("gsettings")
|
||||
.args(["set", https.as_str(), "host", host])
|
||||
.status()?;
|
||||
Command::new("gsettings")
|
||||
.args(["set", https.as_str(), "port", port])
|
||||
.status()?;
|
||||
|
||||
let socks = format!("{schema}.socks");
|
||||
Command::new("gsettings")
|
||||
.args(["set", socks.as_str(), "host", host])
|
||||
.status()?;
|
||||
Command::new("gsettings")
|
||||
.args(["set", socks.as_str(), "port", port])
|
||||
.status()?;
|
||||
|
||||
// set bypass
|
||||
// Todo: parse the ignore-hosts
|
||||
// aaa,bbb,cccc -> ['aaa', 'bbb', 'ccc']
|
||||
Command::new("gsettings")
|
||||
.args(["set", schema, "ignore-hosts", bypass.as_str()]) // todo
|
||||
.status()?;
|
||||
}
|
||||
|
||||
let mode = if enable { "'manual'" } else { "'none'" };
|
||||
Command::new("gsettings")
|
||||
.args(["set", schema, "mode", mode])
|
||||
.status()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// help function
|
||||
fn get_proxy(typ: &str) -> Result<String> {
|
||||
use std::process::Command;
|
||||
|
||||
let schema = format!("org.gnome.system.proxy.{typ}");
|
||||
let schema = schema.as_str();
|
||||
|
||||
let host = Command::new("gsettings")
|
||||
.args(["get", schema, "host"])
|
||||
.output()?;
|
||||
let host = std::str::from_utf8(&host.stdout)?;
|
||||
|
||||
let port = Command::new("gsettings")
|
||||
.args(["get", schema, "port"])
|
||||
.output()?;
|
||||
let port = std::str::from_utf8(&port.stdout)?;
|
||||
|
||||
Ok(format!("{host}:{port}"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ items: ~
|
||||
/// template for `verge.yaml`
|
||||
pub const VERGE_CONFIG: &[u8] = b"# Defaulf Config For Clash Verge
|
||||
|
||||
language: en
|
||||
theme_mode: light
|
||||
theme_blur: false
|
||||
traffic_graph: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": {
|
||||
"productName": "clash-verge",
|
||||
"version": "0.0.21"
|
||||
"productName": "Clash Verge",
|
||||
"version": "0.0.23"
|
||||
},
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
|
||||
@@ -12,6 +12,7 @@ import useLogSetup from "./use-log-setup";
|
||||
import useTrafficGraph from "./use-traffic-graph";
|
||||
import parseTraffic from "../../utils/parse-traffic";
|
||||
|
||||
// setup the traffic
|
||||
const LayoutTraffic = () => {
|
||||
const portValue = useRecoilValue(atomClashPort);
|
||||
const [traffic, setTraffic] = useState({ up: 0, down: 0 });
|
||||
@@ -26,12 +27,14 @@ const LayoutTraffic = () => {
|
||||
useLogSetup();
|
||||
|
||||
useEffect(() => {
|
||||
let unlisten: () => void = null!;
|
||||
|
||||
// should reconnect the traffic ws
|
||||
listen("restart_clash", () => setRefresh({})).then((fn) => (unlisten = fn));
|
||||
const unlisten = listen("verge://refresh-clash-config", () =>
|
||||
setRefresh({})
|
||||
);
|
||||
|
||||
return () => unlisten?.();
|
||||
return () => {
|
||||
unlisten.then((fn) => fn());
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -34,8 +34,8 @@ const UpdateDialog = (props: Props) => {
|
||||
uploadingState = true;
|
||||
|
||||
try {
|
||||
await killSidecars();
|
||||
await installUpdate();
|
||||
await killSidecars();
|
||||
await relaunch();
|
||||
} catch (err: any) {
|
||||
await restartSidecar();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import dayjs from "dayjs";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { ApiType } from "../../services/types";
|
||||
@@ -10,11 +10,11 @@ const MAX_LOG_NUM = 1000;
|
||||
|
||||
// setup the log websocket
|
||||
export default function useLogSetup() {
|
||||
const [refresh, setRefresh] = useState({});
|
||||
const setLogData = useSetRecoilState(atomLogData);
|
||||
|
||||
useEffect(() => {
|
||||
let ws: WebSocket = null!;
|
||||
let unlisten: () => void = null!;
|
||||
|
||||
const handler = (event: MessageEvent<any>) => {
|
||||
const data = JSON.parse(event.data) as ApiType.LogItem;
|
||||
@@ -25,25 +25,19 @@ export default function useLogSetup() {
|
||||
});
|
||||
};
|
||||
|
||||
(async () => {
|
||||
const { server = "", secret = "" } = await getInfomation();
|
||||
|
||||
getInfomation().then((info) => {
|
||||
const { server = "", secret = "" } = info;
|
||||
ws = new WebSocket(`ws://${server}/logs?token=${secret}`);
|
||||
ws.addEventListener("message", handler);
|
||||
});
|
||||
|
||||
// reconnect the websocket
|
||||
unlisten = await listen("restart_clash", async () => {
|
||||
const { server = "", secret = "" } = await getInfomation();
|
||||
|
||||
ws?.close();
|
||||
ws = new WebSocket(`ws://${server}/logs?token=${secret}`);
|
||||
ws.addEventListener("message", handler);
|
||||
});
|
||||
})();
|
||||
const unlisten = listen("verge://refresh-clash-config", () =>
|
||||
setRefresh({})
|
||||
);
|
||||
|
||||
return () => {
|
||||
ws?.close();
|
||||
unlisten?.();
|
||||
unlisten?.then((fn) => fn());
|
||||
};
|
||||
}, []);
|
||||
}, [refresh]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { mutate } from "swr";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useLockFn, useSetState } from "ahooks";
|
||||
import {
|
||||
Button,
|
||||
@@ -7,8 +7,10 @@ import {
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
IconButton,
|
||||
TextField,
|
||||
} from "@mui/material";
|
||||
import { Settings } from "@mui/icons-material";
|
||||
import { CmdType } from "../../services/types";
|
||||
import { patchProfile } from "../../services/cmds";
|
||||
import Notice from "../base/base-notice";
|
||||
@@ -20,13 +22,18 @@ interface Props {
|
||||
}
|
||||
|
||||
// edit the profile item
|
||||
// remote / local file / merge / script
|
||||
const ProfileEdit = (props: Props) => {
|
||||
const { open, itemData, onClose } = props;
|
||||
const [form, setForm] = useSetState({ ...itemData });
|
||||
const [option, setOption] = useSetState(itemData.option ?? {});
|
||||
const [showOpt, setShowOpt] = useState(!!itemData.option);
|
||||
|
||||
useEffect(() => {
|
||||
if (itemData) {
|
||||
setForm({ ...itemData });
|
||||
setOption(itemData.option ?? {});
|
||||
setShowOpt(!!itemData.option?.user_agent);
|
||||
}
|
||||
}, [itemData]);
|
||||
|
||||
@@ -34,7 +41,14 @@ const ProfileEdit = (props: Props) => {
|
||||
try {
|
||||
const { uid } = itemData;
|
||||
const { name, desc, url } = form;
|
||||
await patchProfile(uid, { uid, name, desc, url });
|
||||
const option_ = itemData.type === "remote" ? option : undefined;
|
||||
|
||||
if (itemData.type === "remote" && !url) {
|
||||
throw new Error("Remote URL should not be null");
|
||||
}
|
||||
|
||||
await patchProfile(uid, { uid, name, desc, url, option: option_ });
|
||||
setShowOpt(false);
|
||||
mutate("getProfiles");
|
||||
onClose();
|
||||
} catch (err: any) {
|
||||
@@ -89,9 +103,28 @@ const ProfileEdit = (props: Props) => {
|
||||
onChange={(e) => setForm({ url: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showOpt && (
|
||||
<TextField
|
||||
{...textFieldProps}
|
||||
label="User Agent"
|
||||
value={option.user_agent}
|
||||
onChange={(e) => setOption({ user_agent: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions sx={{ px: 2, pb: 2 }}>
|
||||
<DialogActions sx={{ px: 2, pb: 2, position: "relative" }}>
|
||||
{form.type === "remote" && (
|
||||
<IconButton
|
||||
size="small"
|
||||
sx={{ position: "absolute", left: 18 }}
|
||||
onClick={() => setShowOpt((o) => !o)}
|
||||
>
|
||||
<Settings />
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
<Button onClick={onClose}>Cancel</Button>
|
||||
<Button onClick={onUpdate} variant="contained">
|
||||
Update
|
||||
|
||||
@@ -98,7 +98,7 @@ const ProfileItem = (props: Props) => {
|
||||
if (loading) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
await updateProfile(itemData.uid, withProxy);
|
||||
await updateProfile(itemData.uid, { with_proxy: withProxy });
|
||||
setLoading(false);
|
||||
mutate("getProfiles");
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import { useSWRConfig } from "swr";
|
||||
import { useLockFn, useSetState } from "ahooks";
|
||||
import {
|
||||
@@ -7,11 +8,13 @@ import {
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
FormControl,
|
||||
IconButton,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Select,
|
||||
TextField,
|
||||
} from "@mui/material";
|
||||
import { Settings } from "@mui/icons-material";
|
||||
import { createProfile } from "../../services/cmds";
|
||||
import Notice from "../base/base-notice";
|
||||
|
||||
@@ -27,12 +30,17 @@ const ProfileNew = (props: Props) => {
|
||||
|
||||
const { mutate } = useSWRConfig();
|
||||
const [form, setForm] = useSetState({
|
||||
type: "remote",
|
||||
name: "",
|
||||
desc: "",
|
||||
type: "remote",
|
||||
url: "",
|
||||
});
|
||||
|
||||
const [showOpt, setShowOpt] = useState(false);
|
||||
const [option, setOption] = useSetState({
|
||||
user_agent: "",
|
||||
}); // able to add more option
|
||||
|
||||
const onCreate = useLockFn(async () => {
|
||||
if (!form.type) {
|
||||
Notice.error("`Type` should not be null");
|
||||
@@ -40,8 +48,18 @@ const ProfileNew = (props: Props) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await createProfile({ ...form });
|
||||
setForm({ name: "", desc: "", type: "remote", url: "" });
|
||||
const name = form.name || `${form.type} file`;
|
||||
|
||||
if (form.type === "remote" && !form.url) {
|
||||
throw new Error("The URL should not be null");
|
||||
}
|
||||
|
||||
const option_ = form.type === "remote" ? option : undefined;
|
||||
await createProfile({ ...form, name, option: option_ });
|
||||
setForm({ type: "remote", name: "", desc: "", url: "" });
|
||||
setOption({ user_agent: "" });
|
||||
setShowOpt(false);
|
||||
|
||||
mutate("getProfiles");
|
||||
onClose();
|
||||
} catch (err: any) {
|
||||
@@ -61,17 +79,10 @@ const ProfileNew = (props: Props) => {
|
||||
<DialogTitle sx={{ pb: 0.5 }}>Create Profile</DialogTitle>
|
||||
|
||||
<DialogContent sx={{ width: 336, pb: 1 }}>
|
||||
<TextField
|
||||
{...textFieldProps}
|
||||
autoFocus
|
||||
label="Name"
|
||||
value={form.name}
|
||||
onChange={(e) => setForm({ name: e.target.value })}
|
||||
/>
|
||||
|
||||
<FormControl size="small" fullWidth sx={{ mt: 2, mb: 1 }}>
|
||||
<InputLabel>Type</InputLabel>
|
||||
<Select
|
||||
autoFocus
|
||||
label="Type"
|
||||
value={form.type}
|
||||
onChange={(e) => setForm({ type: e.target.value })}
|
||||
@@ -83,6 +94,13 @@ const ProfileNew = (props: Props) => {
|
||||
</Select>
|
||||
</FormControl>
|
||||
|
||||
<TextField
|
||||
{...textFieldProps}
|
||||
label="Name"
|
||||
value={form.name}
|
||||
onChange={(e) => setForm({ name: e.target.value })}
|
||||
/>
|
||||
|
||||
<TextField
|
||||
{...textFieldProps}
|
||||
label="Descriptions"
|
||||
@@ -98,9 +116,28 @@ const ProfileNew = (props: Props) => {
|
||||
onChange={(e) => setForm({ url: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showOpt && (
|
||||
<TextField
|
||||
{...textFieldProps}
|
||||
label="User Agent"
|
||||
value={option.user_agent}
|
||||
onChange={(e) => setOption({ user_agent: e.target.value })}
|
||||
/>
|
||||
)}
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions sx={{ px: 2, pb: 2 }}>
|
||||
<DialogActions sx={{ px: 2, pb: 2, position: "relative" }}>
|
||||
{form.type === "remote" && (
|
||||
<IconButton
|
||||
size="small"
|
||||
sx={{ position: "absolute", left: 18 }}
|
||||
onClick={() => setShowOpt((o) => !o)}
|
||||
>
|
||||
<Settings />
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
<Button onClick={onClose}>Cancel</Button>
|
||||
<Button onClick={onCreate} variant="contained">
|
||||
Create
|
||||
|
||||
@@ -75,7 +75,7 @@ const ProxyGroup = ({ group }: Props) => {
|
||||
} else {
|
||||
profile.selected[index] = { name: group.name, now: name };
|
||||
}
|
||||
await patchProfile(profiles!.current!, profile);
|
||||
await patchProfile(profiles!.current!, { selected: profile.selected });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
ListItemText,
|
||||
TextField,
|
||||
@@ -21,15 +22,16 @@ interface Props {
|
||||
}
|
||||
|
||||
const SettingClash = ({ onError }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
const { data: clashConfig } = useSWR("getClashConfig", getClashConfig);
|
||||
const { data: versionData } = useSWR("getVersion", getVersion);
|
||||
|
||||
const {
|
||||
ipv6 = false,
|
||||
"allow-lan": allowLan = false,
|
||||
"log-level": logLevel = "silent",
|
||||
"mixed-port": mixedPort = 0,
|
||||
ipv6,
|
||||
"allow-lan": allowLan,
|
||||
"log-level": logLevel,
|
||||
"mixed-port": mixedPort,
|
||||
} = clashConfig ?? {};
|
||||
|
||||
const setGlobalClashPort = useSetRecoilState(atomClashPort);
|
||||
@@ -64,11 +66,11 @@ const SettingClash = ({ onError }: Props) => {
|
||||
: versionData?.version || "-";
|
||||
|
||||
return (
|
||||
<SettingList title="Clash Setting">
|
||||
<SettingList title={t("Clash Setting")}>
|
||||
<SettingItem>
|
||||
<ListItemText primary="Allow Lan" />
|
||||
<ListItemText primary={t("Allow Lan")} />
|
||||
<GuardState
|
||||
value={allowLan}
|
||||
value={allowLan ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -80,9 +82,9 @@ const SettingClash = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="IPv6" />
|
||||
<ListItemText primary={t("IPv6")} />
|
||||
<GuardState
|
||||
value={ipv6}
|
||||
value={ipv6 ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -94,9 +96,9 @@ const SettingClash = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Log Level" />
|
||||
<ListItemText primary={t("Log Level")} />
|
||||
<GuardState
|
||||
value={logLevel}
|
||||
value={logLevel ?? "info"}
|
||||
onCatch={onError}
|
||||
onFormat={(e: any) => e.target.value}
|
||||
onChange={(e) => onChangeData({ "log-level": e })}
|
||||
@@ -113,9 +115,9 @@ const SettingClash = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Mixed Port" />
|
||||
<ListItemText primary={t("Mixed Port")} />
|
||||
<GuardState
|
||||
value={mixedPort!}
|
||||
value={mixedPort ?? 0}
|
||||
onCatch={onError}
|
||||
onFormat={(e: any) => +e.target.value?.replace(/\D+/, "")}
|
||||
onChange={(e) => onChangeData({ "mixed-port": e })}
|
||||
@@ -127,7 +129,7 @@ const SettingClash = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Clash core" />
|
||||
<ListItemText primary={t("Clash core")} />
|
||||
<Typography sx={{ py: 1 }}>{clashVer}</Typography>
|
||||
</SettingItem>
|
||||
</SettingList>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Box, ListItemText, Switch, TextField } from "@mui/material";
|
||||
import { getVergeConfig, patchVergeConfig } from "../../services/cmds";
|
||||
import { SettingList, SettingItem } from "./setting";
|
||||
@@ -11,15 +12,16 @@ interface Props {
|
||||
}
|
||||
|
||||
const SettingSystem = ({ onError }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
||||
|
||||
const {
|
||||
enable_tun_mode = false,
|
||||
enable_auto_launch = false,
|
||||
enable_system_proxy = false,
|
||||
system_proxy_bypass = "",
|
||||
enable_proxy_guard = false,
|
||||
enable_tun_mode,
|
||||
enable_auto_launch,
|
||||
enable_system_proxy,
|
||||
system_proxy_bypass,
|
||||
enable_proxy_guard,
|
||||
} = vergeConfig ?? {};
|
||||
|
||||
const onSwitchFormat = (_e: any, value: boolean) => value;
|
||||
@@ -28,11 +30,11 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<SettingList title="System Setting">
|
||||
<SettingList title={t("System Setting")}>
|
||||
<SettingItem>
|
||||
<ListItemText primary="Tun Mode" />
|
||||
<ListItemText primary={t("Tun Mode")} />
|
||||
<GuardState
|
||||
value={enable_tun_mode}
|
||||
value={enable_tun_mode ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -44,9 +46,9 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Auto Launch" />
|
||||
<ListItemText primary={t("Auto Launch")} />
|
||||
<GuardState
|
||||
value={enable_auto_launch}
|
||||
value={enable_auto_launch ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -61,13 +63,13 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
<ListItemText
|
||||
primary={
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
System Proxy
|
||||
{t("System Proxy")}
|
||||
<SysproxyTooltip />
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
<GuardState
|
||||
value={enable_system_proxy}
|
||||
value={enable_system_proxy ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -83,9 +85,9 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
|
||||
{enable_system_proxy && (
|
||||
<SettingItem>
|
||||
<ListItemText primary="Proxy Guard" />
|
||||
<ListItemText primary={t("Proxy Guard")} />
|
||||
<GuardState
|
||||
value={enable_proxy_guard}
|
||||
value={enable_proxy_guard ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -99,7 +101,7 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
|
||||
{enable_system_proxy && (
|
||||
<SettingItem>
|
||||
<ListItemText primary="Proxy Bypass" />
|
||||
<ListItemText primary={t("Proxy Bypass")} />
|
||||
<GuardState
|
||||
value={system_proxy_bypass ?? ""}
|
||||
onCatch={onError}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
import { IconButton, ListItemText, Switch, Typography } from "@mui/material";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
IconButton,
|
||||
ListItemText,
|
||||
MenuItem,
|
||||
Select,
|
||||
Switch,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import {
|
||||
getVergeConfig,
|
||||
openAppDir,
|
||||
@@ -18,11 +26,11 @@ interface Props {
|
||||
}
|
||||
|
||||
const SettingVerge = ({ onError }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
||||
|
||||
const { theme_mode = "light", theme_blur = false, traffic_graph } =
|
||||
vergeConfig ?? {};
|
||||
const { theme_mode, theme_blur, traffic_graph, language } = vergeConfig ?? {};
|
||||
|
||||
const onSwitchFormat = (_e: any, value: boolean) => value;
|
||||
const onChangeData = (patch: Partial<CmdType.VergeConfig>) => {
|
||||
@@ -30,9 +38,9 @@ const SettingVerge = ({ onError }: Props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<SettingList title="Verge Setting">
|
||||
<SettingList title={t("Verge Setting")}>
|
||||
<SettingItem>
|
||||
<ListItemText primary="Theme Mode" />
|
||||
<ListItemText primary={t("Theme Mode")} />
|
||||
<GuardState
|
||||
value={theme_mode === "dark"}
|
||||
valueProps="checked"
|
||||
@@ -48,9 +56,9 @@ const SettingVerge = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Theme Blur" />
|
||||
<ListItemText primary={t("Theme Blur")} />
|
||||
<GuardState
|
||||
value={theme_blur}
|
||||
value={theme_blur ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
@@ -62,7 +70,7 @@ const SettingVerge = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Traffic Graph" />
|
||||
<ListItemText primary={t("Traffic Graph")} />
|
||||
<GuardState
|
||||
value={traffic_graph ?? true}
|
||||
valueProps="checked"
|
||||
@@ -76,21 +84,37 @@ const SettingVerge = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Open App Dir" />
|
||||
<ListItemText primary={t("Language")} />
|
||||
<GuardState
|
||||
value={language ?? "en"}
|
||||
onCatch={onError}
|
||||
onFormat={(e: any) => e.target.value}
|
||||
onChange={(e) => onChangeData({ language: e })}
|
||||
onGuard={(e) => patchVergeConfig({ language: e })}
|
||||
>
|
||||
<Select size="small" sx={{ width: 100 }}>
|
||||
<MenuItem value="zh">中文</MenuItem>
|
||||
<MenuItem value="en">English</MenuItem>
|
||||
</Select>
|
||||
</GuardState>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary={t("Open App Dir")} />
|
||||
<IconButton color="inherit" size="small" onClick={openAppDir}>
|
||||
<ArrowForward />
|
||||
</IconButton>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Open Logs Dir" />
|
||||
<ListItemText primary={t("Open Logs Dir")} />
|
||||
<IconButton color="inherit" size="small" onClick={openLogsDir}>
|
||||
<ArrowForward />
|
||||
</IconButton>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary="Version" />
|
||||
<ListItemText primary={t("Version")} />
|
||||
<Typography sx={{ py: "6px" }}>v{version}</Typography>
|
||||
</SettingItem>
|
||||
</SettingList>
|
||||
|
||||
42
src/locales/en.json
Normal file
42
src/locales/en.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"Label-Proxies": "Proxies",
|
||||
"Label-Profiles": "Profiles",
|
||||
"Label-Connections": "Connections",
|
||||
"Label-Logs": "Logs",
|
||||
"Label-Settings": "Settings",
|
||||
|
||||
"Connections": "Connections",
|
||||
"Logs": "Logs",
|
||||
"Clear": "Clear",
|
||||
"Proxies": "Proxies",
|
||||
"Proxy Groups": "Proxy Groups",
|
||||
"rule": "rule",
|
||||
"global": "global",
|
||||
"direct": "direct",
|
||||
"Profiles": "Profiles",
|
||||
"Profile URL": "Profile URL",
|
||||
"Import": "Import",
|
||||
"New": "New",
|
||||
|
||||
"Settings": "Settings",
|
||||
"Clash Setting": "Clash Setting",
|
||||
"System Setting": "System Setting",
|
||||
"Verge Setting": "Verge Setting",
|
||||
"Allow Lan": "Allow Lan",
|
||||
"IPv6": "IPv6",
|
||||
"Log Level": "Log Level",
|
||||
"Mixed Port": "Mixed Port",
|
||||
"Clash core": "Clash core",
|
||||
"Tun Mode": "Tun Mode",
|
||||
"Auto Launch": "Auto Launch",
|
||||
"System Proxy": "System Proxy",
|
||||
"Proxy Guard": "Proxy Guard",
|
||||
"Proxy Bypass": "Proxy Bypass",
|
||||
"Theme Mode": "Theme Mode",
|
||||
"Theme Blur": "Theme Blur",
|
||||
"Traffic Graph": "Traffic Graph",
|
||||
"Language": "Language",
|
||||
"Open App Dir": "Open App Dir",
|
||||
"Open Logs Dir": "Open Logs Dir",
|
||||
"Version": "Version"
|
||||
}
|
||||
42
src/locales/zh.json
Normal file
42
src/locales/zh.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"Label-Proxies": "代 理",
|
||||
"Label-Profiles": "配 置",
|
||||
"Label-Connections": "连 接",
|
||||
"Label-Logs": "日 志",
|
||||
"Label-Settings": "设 置",
|
||||
|
||||
"Connections": "连接",
|
||||
"Logs": "日志",
|
||||
"Clear": "清除",
|
||||
"Proxies": "代理",
|
||||
"Proxy Groups": "代理组",
|
||||
"rule": "规则",
|
||||
"global": "全局",
|
||||
"direct": "直连",
|
||||
"Profiles": "配置",
|
||||
"Profile URL": "配置文件链接",
|
||||
"Import": "导入",
|
||||
"New": "新建",
|
||||
|
||||
"Settings": "设置",
|
||||
"Clash Setting": "Clash 设置",
|
||||
"System Setting": "系统设置",
|
||||
"Verge Setting": "Verge 设置",
|
||||
"Allow Lan": "局域网连接",
|
||||
"IPv6": "IPv6",
|
||||
"Log Level": "日志等级",
|
||||
"Mixed Port": "端口设置",
|
||||
"Clash core": "Clash 内核",
|
||||
"Tun Mode": "Tun 模式",
|
||||
"Auto Launch": "开机自启",
|
||||
"System Proxy": "系统代理",
|
||||
"Proxy Guard": "系统代理守卫",
|
||||
"Proxy Bypass": "Proxy Bypass",
|
||||
"Theme Mode": "暗夜模式",
|
||||
"Theme Blur": "背景模糊",
|
||||
"Traffic Graph": "流量图显",
|
||||
"Language": "语言设置",
|
||||
"Open App Dir": "应用目录",
|
||||
"Open Logs Dir": "日志目录",
|
||||
"Version": "版本"
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { RecoilRoot } from "recoil";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import Layout from "./pages/_layout";
|
||||
import enhance from "./services/enhance";
|
||||
import "./services/i18n";
|
||||
|
||||
enhance.setup();
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import i18next from "i18next";
|
||||
import useSWR, { SWRConfig, useSWRConfig } from "swr";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
import { alpha, createTheme, List, Paper, ThemeProvider } from "@mui/material";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
@@ -16,6 +18,7 @@ import UpdateButton from "../components/layout/update-button";
|
||||
const isMacos = navigator.userAgent.includes("Mac OS X");
|
||||
|
||||
const Layout = () => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
const { data } = useSWR("getVergeConfig", getVergeConfig);
|
||||
|
||||
@@ -27,16 +30,20 @@ const Layout = () => {
|
||||
if (e.key === "Escape") appWindow.hide();
|
||||
});
|
||||
|
||||
listen("restart_clash", async () => {
|
||||
listen("verge://refresh-clash-config", async () => {
|
||||
// the clash info may be updated
|
||||
await getAxios(true);
|
||||
// make sure that the clash is ok
|
||||
setTimeout(() => mutate("getProxies"), 1000);
|
||||
setTimeout(() => mutate("getProxies"), 2000);
|
||||
mutate("getProxies");
|
||||
mutate("getClashConfig");
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.language) {
|
||||
i18next.changeLanguage(data.language);
|
||||
}
|
||||
}, [data?.language]);
|
||||
|
||||
const theme = useMemo(() => {
|
||||
// const background = mode === "light" ? "#f5f5f5" : "#000";
|
||||
const selectColor = mode === "light" ? "#f5f5f5" : "#d5d5d5";
|
||||
@@ -87,7 +94,7 @@ const Layout = () => {
|
||||
<List className="the-menu" data-windrag>
|
||||
{routers.map((router) => (
|
||||
<LayoutItem key={router.label} to={router.link}>
|
||||
{router.label}
|
||||
{t(router.label)}
|
||||
</LayoutItem>
|
||||
))}
|
||||
</List>
|
||||
|
||||
@@ -6,27 +6,27 @@ import ConnectionsPage from "./connections";
|
||||
|
||||
export const routers = [
|
||||
{
|
||||
label: "Proxies",
|
||||
label: "Label-Proxies",
|
||||
link: "/",
|
||||
ele: ProxiesPage,
|
||||
},
|
||||
{
|
||||
label: "Profiles",
|
||||
label: "Label-Profiles",
|
||||
link: "/profile",
|
||||
ele: ProfilesPage,
|
||||
},
|
||||
{
|
||||
label: "Connections",
|
||||
label: "Label-Connections",
|
||||
link: "/connections",
|
||||
ele: ConnectionsPage,
|
||||
},
|
||||
{
|
||||
label: "Logs",
|
||||
label: "Label-Logs",
|
||||
link: "/logs",
|
||||
ele: LogsPage,
|
||||
},
|
||||
{
|
||||
label: "Settings",
|
||||
label: "Label-Settings",
|
||||
link: "/settings",
|
||||
ele: SettingsPage,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Paper } from "@mui/material";
|
||||
import { Virtuoso } from "react-virtuoso";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ApiType } from "../services/types";
|
||||
import { getInfomation } from "../services/api";
|
||||
import BasePage from "../components/base/base-page";
|
||||
@@ -8,6 +9,8 @@ import ConnectionItem from "../components/connection/connection-item";
|
||||
|
||||
const ConnectionsPage = () => {
|
||||
const initConn = { uploadTotal: 0, downloadTotal: 0, connections: [] };
|
||||
|
||||
const { t } = useTranslation();
|
||||
const [conn, setConn] = useState<ApiType.Connections>(initConn);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -27,7 +30,7 @@ const ConnectionsPage = () => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<BasePage title="Connections" contentStyle={{ height: "100%" }}>
|
||||
<BasePage title={t("Connections")} contentStyle={{ height: "100%" }}>
|
||||
<Paper sx={{ boxShadow: 2, height: "100%" }}>
|
||||
<Virtuoso
|
||||
data={conn.connections}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { useRecoilState } from "recoil";
|
||||
import { Button, Paper } from "@mui/material";
|
||||
import { Virtuoso } from "react-virtuoso";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { atomLogData } from "../services/states";
|
||||
import BasePage from "../components/base/base-page";
|
||||
import LogItem from "../components/log/log-item";
|
||||
|
||||
const LogPage = () => {
|
||||
const { t } = useTranslation();
|
||||
const [logData, setLogData] = useRecoilState(atomLogData);
|
||||
|
||||
return (
|
||||
<BasePage
|
||||
title="Logs"
|
||||
title={t("Logs")}
|
||||
contentStyle={{ height: "100%" }}
|
||||
header={
|
||||
<Button
|
||||
@@ -19,7 +21,7 @@ const LogPage = () => {
|
||||
variant="contained"
|
||||
onClick={() => setLogData([])}
|
||||
>
|
||||
Clear
|
||||
{t("Clear")}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -2,6 +2,7 @@ import useSWR, { useSWRConfig } from "swr";
|
||||
import { useLockFn } from "ahooks";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Box, Button, Grid, TextField } from "@mui/material";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
getProfiles,
|
||||
patchProfile,
|
||||
@@ -19,6 +20,7 @@ import ProfileItem from "../components/profile/profile-item";
|
||||
import ProfileMore from "../components/profile/profile-more";
|
||||
|
||||
const ProfilePage = () => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
|
||||
const [url, setUrl] = useState("");
|
||||
@@ -81,7 +83,10 @@ const ProfilePage = () => {
|
||||
name,
|
||||
now,
|
||||
}));
|
||||
patchProfile(current!, profile).catch(console.error);
|
||||
|
||||
patchProfile(current!, { selected: profile.selected }).catch(
|
||||
console.error
|
||||
);
|
||||
// update proxies cache
|
||||
if (hasChange) mutate("getProxies", getProxies());
|
||||
}, 100);
|
||||
@@ -172,12 +177,12 @@ const ProfilePage = () => {
|
||||
});
|
||||
|
||||
return (
|
||||
<BasePage title="Profiles">
|
||||
<BasePage title={t("Profiles")}>
|
||||
<Box sx={{ display: "flex", mb: 2.5 }}>
|
||||
<TextField
|
||||
id="clas_verge_profile_url"
|
||||
name="profile_url"
|
||||
label="Profile URL"
|
||||
label={t("Profile URL")}
|
||||
size="small"
|
||||
fullWidth
|
||||
value={url}
|
||||
@@ -190,10 +195,10 @@ const ProfilePage = () => {
|
||||
onClick={onImport}
|
||||
sx={{ mr: 1 }}
|
||||
>
|
||||
Import
|
||||
{t("Import")}
|
||||
</Button>
|
||||
<Button variant="contained" onClick={() => setDialogOpen(true)}>
|
||||
New
|
||||
{t("New")}
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
import { useEffect } from "react";
|
||||
import { useLockFn } from "ahooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button, ButtonGroup, List, Paper } from "@mui/material";
|
||||
import { getClashConfig, updateConfigs } from "../services/api";
|
||||
import { patchClashConfig } from "../services/cmds";
|
||||
@@ -10,6 +11,7 @@ import ProxyGroup from "../components/proxy/proxy-group";
|
||||
import ProxyGlobal from "../components/proxy/proxy-global";
|
||||
|
||||
const ProxyPage = () => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
const { data: proxiesData } = useSWR("getProxies", getProxies);
|
||||
const { data: clashConfig } = useSWR("getClashConfig", getClashConfig);
|
||||
@@ -45,7 +47,7 @@ const ProxyPage = () => {
|
||||
return (
|
||||
<BasePage
|
||||
contentStyle={pageStyle}
|
||||
title={showGroup ? "Proxy Groups" : "Proxies"}
|
||||
title={showGroup ? t("Proxy Groups") : t("Proxies")}
|
||||
header={
|
||||
<ButtonGroup size="small">
|
||||
{modeList.map((mode) => (
|
||||
@@ -55,7 +57,7 @@ const ProxyPage = () => {
|
||||
onClick={() => onChangeMode(mode)}
|
||||
sx={{ textTransform: "capitalize" }}
|
||||
>
|
||||
{mode}
|
||||
{t(mode)}
|
||||
</Button>
|
||||
))}
|
||||
</ButtonGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Paper } from "@mui/material";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Notice from "../components/base/base-notice";
|
||||
import BasePage from "../components/base/base-page";
|
||||
import SettingVerge from "../components/setting/setting-verge";
|
||||
@@ -6,12 +7,14 @@ import SettingClash from "../components/setting/setting-clash";
|
||||
import SettingSystem from "../components/setting/setting-system";
|
||||
|
||||
const SettingPage = () => {
|
||||
const onError = (error: any) => {
|
||||
error && Notice.error(error.toString());
|
||||
const { t } = useTranslation();
|
||||
|
||||
const onError = (err: any) => {
|
||||
Notice.error(err?.message || err.toString());
|
||||
};
|
||||
|
||||
return (
|
||||
<BasePage title="Settings">
|
||||
<BasePage title={t("Settings")}>
|
||||
<Paper sx={{ borderRadius: 1, boxShadow: 2, mb: 3 }}>
|
||||
<SettingClash onError={onError} />
|
||||
</Paper>
|
||||
|
||||
@@ -14,7 +14,13 @@ export async function getAxios(force: boolean = false) {
|
||||
try {
|
||||
const info = await getClashInfo();
|
||||
|
||||
if (info?.server) server = info?.server;
|
||||
if (info?.server) {
|
||||
server = info.server;
|
||||
|
||||
// compatible width `external-controller`
|
||||
if (server.startsWith(":")) server = `127.0.0.1${server}`;
|
||||
else if (/^\d+$/.test(server)) server = `127.0.0.1:${server}`;
|
||||
}
|
||||
if (info?.secret) secret = info?.secret;
|
||||
} catch {}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { ApiType, CmdType } from "./types";
|
||||
import Notice from "../components/base/base-notice";
|
||||
|
||||
export async function getProfiles() {
|
||||
return invoke<CmdType.ProfilesConfig>("get_profiles");
|
||||
@@ -22,11 +23,17 @@ export async function viewProfile(index: string) {
|
||||
}
|
||||
|
||||
export async function importProfile(url: string) {
|
||||
return invoke<void>("import_profile", { url, withProxy: true });
|
||||
return invoke<void>("import_profile", {
|
||||
url,
|
||||
option: { with_proxy: true },
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateProfile(index: string, withProxy: boolean) {
|
||||
return invoke<void>("update_profile", { index, withProxy });
|
||||
export async function updateProfile(
|
||||
index: string,
|
||||
option?: CmdType.ProfileOption
|
||||
) {
|
||||
return invoke<void>("update_profile", { index, option });
|
||||
}
|
||||
|
||||
export async function deleteProfile(index: string) {
|
||||
@@ -35,7 +42,7 @@ export async function deleteProfile(index: string) {
|
||||
|
||||
export async function patchProfile(
|
||||
index: string,
|
||||
profile: CmdType.ProfileItem
|
||||
profile: Partial<CmdType.ProfileItem>
|
||||
) {
|
||||
return invoke<void>("patch_profile", { index, profile });
|
||||
}
|
||||
@@ -77,9 +84,13 @@ export async function killSidecars() {
|
||||
}
|
||||
|
||||
export async function openAppDir() {
|
||||
return invoke<void>("open_app_dir");
|
||||
return invoke<void>("open_app_dir").catch((err) =>
|
||||
Notice.error(err?.message || err.toString(), 1500)
|
||||
);
|
||||
}
|
||||
|
||||
export async function openLogsDir() {
|
||||
return invoke<void>("open_logs_dir");
|
||||
return invoke<void>("open_logs_dir").catch((err) =>
|
||||
Notice.error(err?.message || err.toString(), 1500)
|
||||
);
|
||||
}
|
||||
|
||||
17
src/services/i18n.ts
Normal file
17
src/services/i18n.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import en from "../locales/en.json";
|
||||
import zh from "../locales/zh.json";
|
||||
|
||||
const resources = {
|
||||
en: { translation: en },
|
||||
zh: { translation: zh },
|
||||
};
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
lng: "en",
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
});
|
||||
@@ -105,6 +105,12 @@ export namespace CmdType {
|
||||
total: number;
|
||||
expire: number;
|
||||
};
|
||||
option?: ProfileOption;
|
||||
}
|
||||
|
||||
export interface ProfileOption {
|
||||
user_agent?: string;
|
||||
with_proxy?: boolean;
|
||||
}
|
||||
|
||||
export interface ProfilesConfig {
|
||||
@@ -114,6 +120,7 @@ export namespace CmdType {
|
||||
}
|
||||
|
||||
export interface VergeConfig {
|
||||
language?: string;
|
||||
theme_mode?: "light" | "dark";
|
||||
theme_blur?: boolean;
|
||||
traffic_graph?: boolean;
|
||||
|
||||
147
yarn.lock
147
yarn.lock
@@ -227,7 +227,7 @@
|
||||
"@babel/plugin-syntax-jsx" "^7.16.7"
|
||||
"@babel/types" "^7.17.0"
|
||||
|
||||
"@babel/runtime@^7.13.10", "@babel/runtime@^7.17.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7":
|
||||
"@babel/runtime@^7.13.10", "@babel/runtime@^7.14.5", "@babel/runtime@^7.17.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7":
|
||||
version "7.17.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941"
|
||||
integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw==
|
||||
@@ -572,66 +572,72 @@
|
||||
estree-walker "^2.0.1"
|
||||
picomatch "^2.2.2"
|
||||
|
||||
"@tauri-apps/api@^1.0.0-rc.1":
|
||||
version "1.0.0-rc.1"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-1.0.0-rc.1.tgz#ce26a0fe30d8980a4682d50015eec28ed4a23c1e"
|
||||
integrity sha512-VBUOmfT8ea02JB/Qr+FHeaLnug5BRA7ro2pX47q0GZCbZsU9b+iPnOXl0ShJwT0melR7B6iamyhDwkHStMVfQA==
|
||||
"@tauri-apps/api@^1.0.0-rc.2":
|
||||
version "1.0.0-rc.2"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-1.0.0-rc.2.tgz#bac494a6b8868e05f86184d2ee1ccc8477470363"
|
||||
integrity sha512-JhUDCJpfxmf/S1R+yHmJGsher4CGi07Qv4fYeucB7naeFZ7yTQe7S1CHKUZaRYpurGSdwOF3my9k0LyGmpAGYw==
|
||||
dependencies:
|
||||
type-fest "2.11.2"
|
||||
type-fest "2.12.0"
|
||||
|
||||
"@tauri-apps/cli-darwin-arm64@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.0.0-rc.5.tgz#9374be8c96afa1cf77b5647bc81fe1a05006757d"
|
||||
integrity sha512-X+3EIAUGfoL8uE6PBADZC8FcUISe4JPQCxXgaVv6ehoZGoCh/pFJF7AvBGTQxbnvngqM7Xce4Lmh63Io2/5ggw==
|
||||
"@tauri-apps/cli-darwin-arm64@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.0.0-rc.7.tgz#c7d190ea7496381bf456494e93dd8b35005a0e78"
|
||||
integrity sha512-fb1plxZZHDG0KwZOoAl6tuisFU+oZFtNtqK3V2KL+4hz75DyH6BfsrgjyYSecJrtQejL2cHi8q7vUsU+EeLopw==
|
||||
|
||||
"@tauri-apps/cli-darwin-x64@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.0.0-rc.5.tgz#4db1dd56a228bfafe5b3f64c7661abbe5606e804"
|
||||
integrity sha512-fEpgOdAvKdq9C5/yip8RnwP1VS+nRrtKdzzplu4jY6njDVH/Vom8mg+EfXkCY5RveCaoskJMFgUvt10IGeZHBA==
|
||||
"@tauri-apps/cli-darwin-x64@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.0.0-rc.7.tgz#b152f333ea081674e8e6c45d1c3ff1850bff854c"
|
||||
integrity sha512-FOFPNsYUgCDaxEK+9oQ3vv9bMD3XVcOKdh1vo/DImzZNO6fQkcsDC8zlmA+Q4axd+X8kvu0iti1fK8Vl7HIUEA==
|
||||
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.0.0-rc.5.tgz#0f1ff84c534908a54fbe63b45004abc6d4f03f4d"
|
||||
integrity sha512-V7sWSBrpLyvkQxpkHIM8JltYqQhiTpThySDjO8POtrTqkRwM5BXORcCYhxTAKCedecfYK/RNUJ6Q0t7+3jS6DQ==
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.0.0-rc.7.tgz#14fb37a337526200dbbe9b49dabd221b81682b02"
|
||||
integrity sha512-tFzcJtNHy5AInU3E7kKDyhg4Qb7csu3uZ3FhGfORmGvQAiNQFpGV3ypC230RQYa3sxxRMbn8vjUAZMlU6JArbA==
|
||||
|
||||
"@tauri-apps/cli-linux-arm64-gnu@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.0.0-rc.5.tgz#c5d2f1dd962d80a1958261229778b410b86254d4"
|
||||
integrity sha512-HhM+2FInxtUAI/41LF4fDEzmhLQUq6DOoo7fLN94vgWlhsPyWZoDGP9pA043XbO86+4OX5JZUW1SnTVXMwEaMA==
|
||||
"@tauri-apps/cli-linux-arm64-gnu@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.0.0-rc.7.tgz#43e7a38018258ad2bf665bb61e0328688b345355"
|
||||
integrity sha512-QAoNUJMmoCv/mDZsfEZOOTeEPYuxtMgCgqTDqMd0H8S0Y3Cu2D/Q2fwVl0s9pMb6wLD2GJ2FEneySEMhMxt7Pg==
|
||||
|
||||
"@tauri-apps/cli-linux-arm64-musl@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.0.0-rc.5.tgz#f485db9ca5402f5d2c4585801a3aaa4519bd67e8"
|
||||
integrity sha512-DhHdKOhf3+peA/sM0c9CpxK89cp8GVwOB5osFW55fxBZbD0mJFeL2SzjkgfGFqFu6Ci/ZiibQGfEp8XTC8OsYA==
|
||||
"@tauri-apps/cli-linux-arm64-musl@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.0.0-rc.7.tgz#37ebcfc7d1431dd698f529fa57248adadd94b3b4"
|
||||
integrity sha512-ieLyACtbY7ezReTnjWLw/kKDXRCbnbrUjQ+hltSmHaRuV51nX+I2rmFO5e7VPdj406jvyKwfSPuBC34bHxt3Og==
|
||||
|
||||
"@tauri-apps/cli-linux-x64-gnu@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.0.0-rc.5.tgz#e468939585bc98e80ec827d0a3d8ba06a7cc38e8"
|
||||
integrity sha512-pZzsOHRGG/mdcn7fF/yOIOdeVzGxZUtZqvlGSd90ZM9Ps3//uYGCBHoNTbeSwp/V6+D0KVDaSCbm9lYlHoXcdA==
|
||||
"@tauri-apps/cli-linux-x64-gnu@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.0.0-rc.7.tgz#b47239c4f10b3fe8e1e2f031f639125ededc6d79"
|
||||
integrity sha512-wPAZctuFpurACxdCrjw+aaSuFReuIvv1nalVezfqA78AlsCk785yF2YVjoZr5bT8a9+6F+t8uNi3l6Vp5oNqwQ==
|
||||
|
||||
"@tauri-apps/cli-linux-x64-musl@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.0.0-rc.5.tgz#a1308e93850555f2b6c97b5d7cdbbb9afaa803e2"
|
||||
integrity sha512-COwWCbOhEjBlzGRGTa0ESO4/AiC0cBZ2UEPExRn++S+kWSPJ2vsyMdCLu3hiMy1ABSIRcQ4Vc68M1iVkLhOHHw==
|
||||
"@tauri-apps/cli-linux-x64-musl@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.0.0-rc.7.tgz#9e62494cf80aed170f389d84b2b23f354e8ce748"
|
||||
integrity sha512-/AxuXFC2d1V8KpZJ6cFDcD5QqPFIZFXC/tAJlnTW75VnHgjat9TYP3BdSOuEA81ZLs9tV4PQF40tNnUSzfRYMg==
|
||||
|
||||
"@tauri-apps/cli-win32-x64-msvc@1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.0.0-rc.5.tgz#d15c95143d9123d10c510e28ba90df5349b68ecd"
|
||||
integrity sha512-zzizUmPWvnWjj+IUCk36kVjS9j1Bg5JmnwOW5QdX26+a64q5vocmVimCgrfZ5STw3sDFXE++S55ghpzhhH5o+g==
|
||||
"@tauri-apps/cli-win32-ia32-msvc@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.0.0-rc.7.tgz#71c2f9498f4d03fd2c0ca6137a2be7db95a006f3"
|
||||
integrity sha512-C4M2rHXlYVPSHGl2Iax1rfiNM5GPSRP1JHxW7/4jH9FfW6mVFcjULZAyVMRfOMQEQ9bYXbVnSTPbhG2Fm0jPxQ==
|
||||
|
||||
"@tauri-apps/cli@^1.0.0-rc.5":
|
||||
version "1.0.0-rc.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.0.0-rc.5.tgz#db8ca22c9f55f5400d1c6addd78ee1df5dc15a29"
|
||||
integrity sha512-Q3D0R5YdZRA5EcL206hwwKCyXpet2mRDcfaRTU/IXwF73bS4AMja+JdAGfO2cyHuSvXd+b//Cgbei2zCG8M6hw==
|
||||
"@tauri-apps/cli-win32-x64-msvc@1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.0.0-rc.7.tgz#6d719f70a0789f2a179d160c302996ce81194099"
|
||||
integrity sha512-lpstJKOtP+ahhjbutapA02TpvfNTZqXwhmA1fvqxDu6BYVezFn7ZiGG5HwdXlkiRDfbwZwBd1evdkV3MxwY1NQ==
|
||||
|
||||
"@tauri-apps/cli@^1.0.0-rc.7":
|
||||
version "1.0.0-rc.7"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.0.0-rc.7.tgz#0eb73718f6ebddc159b0b54f6fd6dfc26d110b36"
|
||||
integrity sha512-g7lUsI2iFiB2JuPFr209vWNqOnxCOGXN6yBttMRY+94UUXZOeWlKxYYpSabyjSr7EbfAUNzjITYmE4urdtmB+A==
|
||||
optionalDependencies:
|
||||
"@tauri-apps/cli-darwin-arm64" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-darwin-x64" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-linux-arm64-gnu" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-linux-arm64-musl" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-linux-x64-gnu" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-linux-x64-musl" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-win32-x64-msvc" "1.0.0-rc.5"
|
||||
"@tauri-apps/cli-darwin-arm64" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-darwin-x64" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-linux-arm64-gnu" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-linux-arm64-musl" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-linux-x64-gnu" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-linux-x64-musl" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-win32-ia32-msvc" "1.0.0-rc.7"
|
||||
"@tauri-apps/cli-win32-x64-msvc" "1.0.0-rc.7"
|
||||
|
||||
"@types/fs-extra@^9.0.13":
|
||||
version "9.0.13"
|
||||
@@ -1285,6 +1291,18 @@ hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2:
|
||||
dependencies:
|
||||
react-is "^16.7.0"
|
||||
|
||||
html-escaper@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
|
||||
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
||||
|
||||
html-parse-stringify@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz#dfc1017347ce9f77c8141a507f233040c59c55d2"
|
||||
integrity sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==
|
||||
dependencies:
|
||||
void-elements "3.1.0"
|
||||
|
||||
human-signals@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
|
||||
@@ -1295,6 +1313,13 @@ husky@^7.0.0:
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535"
|
||||
integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==
|
||||
|
||||
i18next@^21.6.14:
|
||||
version "21.6.14"
|
||||
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.6.14.tgz#2bc199fba7f4da44b5952d7df0a3814a6e5c3943"
|
||||
integrity sha512-XL6WyD+xlwQwbieXRlXhKWoLb/rkch50/rA+vl6untHnJ+aYnkQ0YDZciTWE78PPhOpbi2gR0LTJCJpiAhA+uQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.17.2"
|
||||
|
||||
ignore@^5.1.4:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
|
||||
@@ -1647,6 +1672,15 @@ react-dom@^17.0.2:
|
||||
object-assign "^4.1.1"
|
||||
scheduler "^0.20.2"
|
||||
|
||||
react-i18next@^11.15.6:
|
||||
version "11.15.6"
|
||||
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.15.6.tgz#693430fbee5ac7d0774bd88683575d62adb24afb"
|
||||
integrity sha512-OUWcFdNgIA9swVx3JGIreuquglAinpRwB/HYrCprTN+s9BQDt9LSiY7x5DGc2JzVpwqtpoTV7oRUTOxEPNyUPw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.14.5"
|
||||
html-escaper "^2.0.2"
|
||||
html-parse-stringify "^3.0.1"
|
||||
|
||||
react-is@^16.13.1, react-is@^16.7.0:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
@@ -1863,10 +1897,10 @@ tunnel@0.0.6:
|
||||
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
|
||||
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
|
||||
|
||||
type-fest@2.11.2:
|
||||
version "2.11.2"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.11.2.tgz#5534a919858bc517492cd3a53a673835a76d2e71"
|
||||
integrity sha512-reW2Y2Mpn0QNA/5fvtm5doROLwDPu2zOm5RtY7xQQS05Q7xgC8MOZ3yPNaP9m/s/sNjjFQtHo7VCNqYW2iI+Ig==
|
||||
type-fest@2.12.0:
|
||||
version "2.12.0"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.12.0.tgz#ce342f58cab9114912f54b493d60ab39c3fc82b6"
|
||||
integrity sha512-Qe5GRT+n/4GoqCNGGVp5Snapg1Omq3V7irBJB3EaKsp7HWDo5Gv2d/67gfNyV+d5EXD+x/RF5l1h4yJ7qNkcGA==
|
||||
|
||||
typescript@^4.5.5:
|
||||
version "4.6.2"
|
||||
@@ -1895,6 +1929,11 @@ vite@^2.8.6:
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
void-elements@3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
|
||||
integrity sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=
|
||||
|
||||
web-streams-polyfill@^3.0.3:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965"
|
||||
|
||||
Reference in New Issue
Block a user