mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-15 19:22:26 +08:00
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": {
|
||||
"dev": "tauri dev",
|
||||
"build": "tauri build",
|
||||
"web:dev": "vite",
|
||||
"web:build": "tsc && vite build",
|
||||
"web:serve": "vite preview"
|
||||
"web:dev": "parcel src/index.html -p 3000",
|
||||
"web:build": "parcel build",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.7.0",
|
||||
|
@ -19,12 +19,12 @@
|
|||
"react-router-dom": "^6.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-sass": "^2.0.1",
|
||||
"@tauri-apps/cli": "^1.0.0-beta.10",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@vitejs/plugin-react": "^1.0.0",
|
||||
"parcel": "^2.0.1",
|
||||
"sass": "^1.44.0",
|
||||
"typescript": "^4.5.2",
|
||||
"vite": "^2.6.14"
|
||||
"typescript": "^4.5.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ default-run = "app"
|
|||
edition = "2021"
|
||||
build = "src/build.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.0-beta.4" }
|
||||
|
||||
|
@ -20,10 +18,12 @@ serde_json = "1.0"
|
|||
serde_yaml = "0.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.0-beta.8", features = ["api-all", "system-tray"] }
|
||||
winreg = { version = "0.10", features = ["transactions"] }
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = { version = "0.10", features = ["transactions"] }
|
||||
|
||||
[features]
|
||||
default = [ "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<()> {
|
||||
let config = sysopt::get_proxy_config()?;
|
||||
println!("{:?}", config);
|
||||
clash::run_clash_bin(&clash::get_config_dir().to_str().unwrap());
|
||||
|
||||
let app = tauri::Builder::default()
|
||||
.system_tray(
|
||||
SystemTray::new()
|
||||
.with_menu(SystemTrayMenu::new().add_item(CustomMenuItem::new("tray_event_quit", "Quit"))),
|
||||
SystemTray::new().with_menu(
|
||||
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 {
|
||||
SystemTrayEvent::LeftClick { .. } => {
|
||||
|
@ -35,7 +37,12 @@ fn main() -> std::io::Result<()> {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::io;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use winreg::enums::*;
|
||||
#[cfg(target_os = "windows")]
|
||||
use winreg::RegKey;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": ["bin/clash"],
|
||||
"externalBin": ["sidebar/clash"],
|
||||
"copyright": "",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "",
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
<title>Vite App</title>
|
||||
<title>Clash Verge</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
</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