format: format code
This commit is contained in:
@@ -52,7 +52,7 @@ pub struct PakeConfig {
|
||||
pub user_agent: UserAgent,
|
||||
pub system_tray: FunctionON,
|
||||
pub system_tray_path: String,
|
||||
pub proxy_url: String
|
||||
pub proxy_url: String,
|
||||
}
|
||||
|
||||
impl PakeConfig {
|
||||
|
||||
@@ -29,9 +29,10 @@ pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result
|
||||
let client = ClientBuilder::new().build().unwrap();
|
||||
|
||||
let response = client
|
||||
.execute(
|
||||
Request::new(Method::GET, Url::from_str(¶ms.url).unwrap())
|
||||
)
|
||||
.execute(Request::new(
|
||||
Method::GET,
|
||||
Url::from_str(¶ms.url).unwrap(),
|
||||
))
|
||||
.await;
|
||||
|
||||
match response {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use tauri::{
|
||||
image::Image, include_image, menu::{ContextMenu, MenuBuilder, MenuItemBuilder}, tray::{MouseButton, MouseButtonState, TrayIcon, TrayIconBuilder, TrayIconEvent}, AppHandle, Config, Manager
|
||||
image::Image,
|
||||
menu::{MenuBuilder, MenuItemBuilder},
|
||||
tray::{MouseButtonState, TrayIconBuilder, TrayIconEvent, MouseButton},
|
||||
AppHandle, Manager,
|
||||
};
|
||||
use tauri_plugin_window_state::{AppHandleExt, StateFlags};
|
||||
|
||||
@@ -9,22 +12,24 @@ pub fn set_system_tray(app: &AppHandle, pake_config: &PakeConfig) -> tauri::Resu
|
||||
let hide_app = MenuItemBuilder::with_id("hide_app", "Hide").build(app)?;
|
||||
let show_app = MenuItemBuilder::with_id("show_app", "Show").build(app)?;
|
||||
let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
|
||||
let menu = MenuBuilder::new(app).items(&[&hide_app, &show_app, &quit]).build()?;
|
||||
let menu = MenuBuilder::new(app)
|
||||
.items(&[&hide_app, &show_app, &quit])
|
||||
.build()?;
|
||||
app.app_handle().remove_tray_by_id("pake-tray");
|
||||
let tray = TrayIconBuilder::new()
|
||||
.icon(Image::from_path(pake_config.system_tray_path.as_str())?)
|
||||
.menu(&menu)
|
||||
.on_tray_icon_event(move |tray, event| {
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
..
|
||||
} = event {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
..
|
||||
} = event
|
||||
{
|
||||
println!("click");
|
||||
|
||||
let app = tray.app_handle();
|
||||
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
if let Some(webview_window) = app.get_webview_window("pake") {
|
||||
@@ -37,7 +42,6 @@ pub fn set_system_tray(app: &AppHandle, pake_config: &PakeConfig) -> tauri::Resu
|
||||
tauri::AppHandle::show(&app.app_handle()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.on_menu_event(move |app, event| match event.id().as_ref() {
|
||||
"hide_app" => {
|
||||
|
||||
@@ -42,7 +42,8 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
|
||||
|
||||
if config.proxy_url != "" {
|
||||
println!("{}", &config.proxy_url);
|
||||
window_builder = window_builder.proxy_url(Url::from_str(&config.proxy_url.as_str()).unwrap());
|
||||
window_builder =
|
||||
window_builder.proxy_url(Url::from_str(&config.proxy_url.as_str()).unwrap());
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
Reference in New Issue
Block a user