chore: compatible with macos
This commit is contained in:
parent
e22470969e
commit
f320d515d5
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
12
package.json
12
package.json
@ -4,9 +4,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tauri dev",
|
"dev": "tauri dev",
|
||||||
"build": "tauri build",
|
"build": "tauri build",
|
||||||
"web:dev": "vite",
|
"web:dev": "parcel src/index.html -p 3000",
|
||||||
"web:build": "tsc && vite build",
|
"web:build": "parcel build",
|
||||||
"web:serve": "vite preview"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.7.0",
|
"@emotion/react": "^11.7.0",
|
||||||
@ -19,12 +19,12 @@
|
|||||||
"react-router-dom": "^6.0.2"
|
"react-router-dom": "^6.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@parcel/transformer-sass": "^2.0.1",
|
||||||
"@tauri-apps/cli": "^1.0.0-beta.10",
|
"@tauri-apps/cli": "^1.0.0-beta.10",
|
||||||
"@types/react": "^17.0.0",
|
"@types/react": "^17.0.0",
|
||||||
"@types/react-dom": "^17.0.0",
|
"@types/react-dom": "^17.0.0",
|
||||||
"@vitejs/plugin-react": "^1.0.0",
|
"parcel": "^2.0.1",
|
||||||
"sass": "^1.44.0",
|
"sass": "^1.44.0",
|
||||||
"typescript": "^4.5.2",
|
"typescript": "^4.5.2"
|
||||||
"vite": "^2.6.14"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ default-run = "app"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "src/build.rs"
|
build = "src/build.rs"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "1.0.0-beta.4" }
|
tauri-build = { version = "1.0.0-beta.4" }
|
||||||
|
|
||||||
@ -20,10 +18,12 @@ serde_json = "1.0"
|
|||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.0.0-beta.8", features = ["api-all", "system-tray"] }
|
tauri = { version = "1.0.0-beta.8", features = ["api-all", "system-tray"] }
|
||||||
winreg = { version = "0.10", features = ["transactions"] }
|
|
||||||
reqwest = { version = "0.11", features = ["json"] }
|
reqwest = { version = "0.11", features = ["json"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winreg = { version = "0.10", features = ["transactions"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "custom-protocol" ]
|
default = [ "custom-protocol" ]
|
||||||
custom-protocol = [ "tauri/custom-protocol" ]
|
custom-protocol = [ "tauri/custom-protocol" ]
|
||||||
|
@ -19,13 +19,15 @@ async fn get_config_data(url: String) -> Result<String, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
let config = sysopt::get_proxy_config()?;
|
clash::run_clash_bin(&clash::get_config_dir().to_str().unwrap());
|
||||||
println!("{:?}", config);
|
|
||||||
|
|
||||||
let app = tauri::Builder::default()
|
let app = tauri::Builder::default()
|
||||||
.system_tray(
|
.system_tray(
|
||||||
SystemTray::new()
|
SystemTray::new().with_menu(
|
||||||
.with_menu(SystemTrayMenu::new().add_item(CustomMenuItem::new("tray_event_quit", "Quit"))),
|
SystemTrayMenu::new()
|
||||||
|
.add_item(CustomMenuItem::new("event_show", "Show"))
|
||||||
|
.add_item(CustomMenuItem::new("event_quit", "Quit")),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.on_system_tray_event(move |app, event| match event {
|
.on_system_tray_event(move |app, event| match event {
|
||||||
SystemTrayEvent::LeftClick { .. } => {
|
SystemTrayEvent::LeftClick { .. } => {
|
||||||
@ -35,7 +37,12 @@ fn main() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
||||||
"tray_event_quit" => {
|
"event_show" => {
|
||||||
|
let window = app.get_window("main").unwrap();
|
||||||
|
window.show().unwrap();
|
||||||
|
window.set_focus().unwrap();
|
||||||
|
}
|
||||||
|
"event_quit" => {
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use winreg::enums::*;
|
use winreg::enums::*;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use winreg::RegKey;
|
use winreg::RegKey;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
],
|
],
|
||||||
"resources": [],
|
"resources": [],
|
||||||
"externalBin": ["bin/clash"],
|
"externalBin": ["sidebar/clash"],
|
||||||
"copyright": "",
|
"copyright": "",
|
||||||
"category": "DeveloperTool",
|
"category": "DeveloperTool",
|
||||||
"shortDescription": "",
|
"shortDescription": "",
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||||
/>
|
/>
|
||||||
<title>Vite App</title>
|
<title>Clash Verge</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="./main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
/// <reference types="vite/client" />
|
|
@ -1,7 +0,0 @@
|
|||||||
import { defineConfig } from "vite";
|
|
||||||
import react from "@vitejs/plugin-react";
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user