mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	refactor: upgrade tauri 2.0
This commit is contained in:
		
							
								
								
									
										1950
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1950
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										22
									
								
								Cargo.toml
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								Cargo.toml
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
[workspace]
 | 
					[workspace]
 | 
				
			||||||
resolver = "2"
 | 
					resolver = "2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
members = ["crates/*", "apps/gpclient", "apps/gpservice"]
 | 
					members = ["crates/*", "apps/gpclient", "apps/gpservice", "apps/gpgui-helper/src-tauri"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[workspace.package]
 | 
					[workspace.package]
 | 
				
			||||||
rust-version = "1.70"
 | 
					rust-version = "1.70"
 | 
				
			||||||
@@ -13,22 +13,22 @@ license = "GPL-3.0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[workspace.dependencies]
 | 
					[workspace.dependencies]
 | 
				
			||||||
anyhow = "1.0"
 | 
					anyhow = "1.0"
 | 
				
			||||||
base64 = "0.21"
 | 
					base64 = "0.22"
 | 
				
			||||||
clap = { version = "4.4.2", features = ["derive"] }
 | 
					clap = { version = "4", features = ["derive"] }
 | 
				
			||||||
ctrlc = "3.4"
 | 
					ctrlc = "3.4"
 | 
				
			||||||
directories = "5.0"
 | 
					directories = "5.0"
 | 
				
			||||||
dns-lookup = "2.0.4"
 | 
					dns-lookup = "2.0.4"
 | 
				
			||||||
env_logger = "0.10"
 | 
					env_logger = "0.11"
 | 
				
			||||||
is_executable = "1.0"
 | 
					is_executable = "1.0"
 | 
				
			||||||
log = "0.4"
 | 
					log = "0.4"
 | 
				
			||||||
regex = "1"
 | 
					regex = "1"
 | 
				
			||||||
reqwest = { version = "0.11", features = ["native-tls-vendored", "json"] }
 | 
					reqwest = { version = "0.12", features = ["native-tls-vendored", "json"] }
 | 
				
			||||||
openssl = "0.10"
 | 
					openssl = "0.10"
 | 
				
			||||||
pem = "3"
 | 
					pem = "3"
 | 
				
			||||||
roxmltree = "0.18"
 | 
					roxmltree = "0.20"
 | 
				
			||||||
serde = { version = "1.0", features = ["derive"] }
 | 
					serde = { version = "1.0", features = ["derive"] }
 | 
				
			||||||
serde_json = "1.0"
 | 
					serde_json = "1.0"
 | 
				
			||||||
sysinfo = "0.29"
 | 
					sysinfo = "0.33"
 | 
				
			||||||
tempfile = "3.8"
 | 
					tempfile = "3.8"
 | 
				
			||||||
tokio = { version = "1", features = ["full"] }
 | 
					tokio = { version = "1", features = ["full"] }
 | 
				
			||||||
tokio-util = "0.7"
 | 
					tokio-util = "0.7"
 | 
				
			||||||
@@ -38,21 +38,19 @@ axum = "0.7"
 | 
				
			|||||||
futures = "0.3"
 | 
					futures = "0.3"
 | 
				
			||||||
futures-util = "0.3"
 | 
					futures-util = "0.3"
 | 
				
			||||||
tokio-tungstenite = "0.20.1"
 | 
					tokio-tungstenite = "0.20.1"
 | 
				
			||||||
uzers = "0.11"
 | 
					uzers = "0.12"
 | 
				
			||||||
whoami = "1"
 | 
					whoami = "1"
 | 
				
			||||||
thiserror = "1"
 | 
					thiserror = "2"
 | 
				
			||||||
redact-engine = "0.1"
 | 
					redact-engine = "0.1"
 | 
				
			||||||
compile-time = "0.2"
 | 
					compile-time = "0.2"
 | 
				
			||||||
serde_urlencoded = "0.7"
 | 
					serde_urlencoded = "0.7"
 | 
				
			||||||
md5="0.7"
 | 
					md5="0.7"
 | 
				
			||||||
sha256="1"
 | 
					sha256="1"
 | 
				
			||||||
which="6"
 | 
					which="7"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Tauri dependencies
 | 
					# Tauri dependencies
 | 
				
			||||||
tauri = { version = "2" }
 | 
					tauri = { version = "2" }
 | 
				
			||||||
specta = "=2.0.0-rc.20"
 | 
					specta = "=2.0.0-rc.20"
 | 
				
			||||||
specta-macros = "=2.0.0-rc.17"
 | 
					 | 
				
			||||||
#rspc = { version = "1.0.0-rc.5", features = ["tauri"] }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[profile.release]
 | 
					[profile.release]
 | 
				
			||||||
opt-level = 'z'   # Optimize for size
 | 
					opt-level = 'z'   # Optimize for size
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ use gpapi::{
 | 
				
			|||||||
  clap::args::Os,
 | 
					  clap::args::Os,
 | 
				
			||||||
  gp_params::{ClientOs, GpParams},
 | 
					  gp_params::{ClientOs, GpParams},
 | 
				
			||||||
  process::browser_authenticator::BrowserAuthenticator,
 | 
					  process::browser_authenticator::BrowserAuthenticator,
 | 
				
			||||||
  utils::{normalize_server, openssl},
 | 
					  utils::{env_utils, normalize_server, openssl},
 | 
				
			||||||
  GP_USER_AGENT,
 | 
					  GP_USER_AGENT,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use log::{info, LevelFilter};
 | 
					use log::{info, LevelFilter};
 | 
				
			||||||
@@ -138,14 +138,7 @@ impl Cli {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fn prepare_env(&self) -> anyhow::Result<Option<NamedTempFile>> {
 | 
					  fn prepare_env(&self) -> anyhow::Result<Option<NamedTempFile>> {
 | 
				
			||||||
    std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
 | 
					    env_utils::patch_gui_runtime_env(self.hidpi);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if self.hidpi {
 | 
					 | 
				
			||||||
      info!("Setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      std::env::set_var("GDK_SCALE", "2");
 | 
					 | 
				
			||||||
      std::env::set_var("GDK_DPI_SCALE", "0.5");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if self.fix_openssl {
 | 
					    if self.fix_openssl {
 | 
				
			||||||
      info!("Fixing OpenSSL environment");
 | 
					      info!("Fixing OpenSSL environment");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
use crate::GP_CLIENT_LOCK_FILE;
 | 
					use crate::GP_CLIENT_LOCK_FILE;
 | 
				
			||||||
use log::{info, warn};
 | 
					use log::{info, warn};
 | 
				
			||||||
use std::fs;
 | 
					use std::fs;
 | 
				
			||||||
use sysinfo::{Pid, ProcessExt, Signal, System, SystemExt};
 | 
					use sysinfo::{Pid, Signal, System};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub(crate) struct DisconnectHandler;
 | 
					pub(crate) struct DisconnectHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ use clap::Args;
 | 
				
			|||||||
use directories::ProjectDirs;
 | 
					use directories::ProjectDirs;
 | 
				
			||||||
use gpapi::{
 | 
					use gpapi::{
 | 
				
			||||||
  process::service_launcher::ServiceLauncher,
 | 
					  process::service_launcher::ServiceLauncher,
 | 
				
			||||||
  utils::{endpoint::http_endpoint, env_file, shutdown_signal},
 | 
					  utils::{endpoint::http_endpoint, env_utils, shutdown_signal},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use log::info;
 | 
					use log::info;
 | 
				
			||||||
use tokio::io::AsyncWriteExt;
 | 
					use tokio::io::AsyncWriteExt;
 | 
				
			||||||
@@ -62,7 +62,7 @@ impl<'a> LaunchGuiHandler<'a> {
 | 
				
			|||||||
    extra_envs.insert("GP_LOG_FILE".into(), log_file_path.clone());
 | 
					    extra_envs.insert("GP_LOG_FILE".into(), log_file_path.clone());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Persist the environment variables to a file
 | 
					    // Persist the environment variables to a file
 | 
				
			||||||
    let env_file = env_file::persist_env_vars(Some(extra_envs))?;
 | 
					    let env_file = env_utils::persist_env_vars(Some(extra_envs))?;
 | 
				
			||||||
    let env_file = env_file.into_temp_path();
 | 
					    let env_file = env_file.into_temp_path();
 | 
				
			||||||
    let env_file_path = env_file.to_string_lossy().to_string();
 | 
					    let env_file_path = env_file.to_string_lossy().to_string();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,29 +9,29 @@
 | 
				
			|||||||
    "tauri": "tauri"
 | 
					    "tauri": "tauri"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@emotion/react": "^11.13.0",
 | 
					    "@emotion/react": "^11.14.0",
 | 
				
			||||||
    "@emotion/styled": "^11.13.0",
 | 
					    "@emotion/styled": "^11.14.0",
 | 
				
			||||||
    "@mui/icons-material": "^5.16.7",
 | 
					    "@mui/icons-material": "^6.2.0",
 | 
				
			||||||
    "@mui/material": "^5.16.7",
 | 
					    "@mui/material": "^6.2.0",
 | 
				
			||||||
    "@tauri-apps/api": "^1.6.0",
 | 
					    "@tauri-apps/api": "^2.1.1",
 | 
				
			||||||
    "react": "^18.3.1",
 | 
					    "react": "^18.3.1",
 | 
				
			||||||
    "react-dom": "^18.3.1"
 | 
					    "react-dom": "^18.3.1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@tauri-apps/cli": "^1.6.0",
 | 
					    "@tauri-apps/cli": "^2.1.0",
 | 
				
			||||||
    "@types/node": "^20.14.15",
 | 
					    "@types/node": "^22.10.2",
 | 
				
			||||||
    "@types/react": "^18.3.3",
 | 
					    "@types/react": "^18.3.12",
 | 
				
			||||||
    "@types/react-dom": "^18.3.0",
 | 
					    "@types/react-dom": "^18.3.1",
 | 
				
			||||||
    "@typescript-eslint/eslint-plugin": "^6.21.0",
 | 
					    "@typescript-eslint/eslint-plugin": "^8.18.0",
 | 
				
			||||||
    "@typescript-eslint/parser": "^6.21.0",
 | 
					    "@typescript-eslint/parser": "^8.18.0",
 | 
				
			||||||
    "@vitejs/plugin-react": "^4.3.1",
 | 
					    "@vitejs/plugin-react": "^4.3.4",
 | 
				
			||||||
    "eslint": "^8.57.0",
 | 
					    "eslint": "^9.16.0",
 | 
				
			||||||
    "eslint-config-prettier": "^9.1.0",
 | 
					    "eslint-config-prettier": "^9.1.0",
 | 
				
			||||||
    "eslint-plugin-react": "^7.35.0",
 | 
					    "eslint-plugin-react": "^7.37.2",
 | 
				
			||||||
    "eslint-plugin-react-hooks": "^4.6.2",
 | 
					    "eslint-plugin-react-hooks": "^5.1.0",
 | 
				
			||||||
    "prettier": "3.1.0",
 | 
					    "prettier": "3.4.2",
 | 
				
			||||||
    "typescript": "^5.5.4",
 | 
					    "typescript": "^5.7.2",
 | 
				
			||||||
    "vite": "^4.5.3"
 | 
					    "vite": "^6.0.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "packageManager": "pnpm@8.15.7"
 | 
					  "packageManager": "pnpm@8.15.7"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2093
									
								
								apps/gpgui-helper/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2093
									
								
								apps/gpgui-helper/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -6,11 +6,12 @@ edition.workspace = true
 | 
				
			|||||||
license.workspace = true
 | 
					license.workspace = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[build-dependencies]
 | 
					[build-dependencies]
 | 
				
			||||||
tauri-build = { version = "1.5", features = [] }
 | 
					tauri-build = { version = "2", features = [] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
gpapi = { path = "../../../crates/gpapi", features = ["tauri"] }
 | 
					gpapi = { path = "../../../crates/gpapi", features = ["tauri"] }
 | 
				
			||||||
tauri = { workspace = true, features = ["window-start-dragging"] }
 | 
					tauri.workspace = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tokio.workspace = true
 | 
					tokio.workspace = true
 | 
				
			||||||
anyhow.workspace = true
 | 
					anyhow.workspace = true
 | 
				
			||||||
log.workspace = true
 | 
					log.workspace = true
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								apps/gpgui-helper/src-tauri/capabilities/default.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								apps/gpgui-helper/src-tauri/capabilities/default.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "$schema": "../gen/schemas/desktop-schema.json",
 | 
				
			||||||
 | 
					  "identifier": "default",
 | 
				
			||||||
 | 
					  "description": "Capability for the main window",
 | 
				
			||||||
 | 
					  "windows": ["main"],
 | 
				
			||||||
 | 
					  "permissions": [
 | 
				
			||||||
 | 
					    "core:window:allow-start-dragging",
 | 
				
			||||||
 | 
					    "core:event:allow-listen",
 | 
				
			||||||
 | 
					    "core:event:allow-emit",
 | 
				
			||||||
 | 
					    "core:event:allow-unlisten"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main"],"permissions":["core:window:allow-start-dragging","core:event:allow-listen","core:event:allow-emit","core:event:allow-unlisten"]}}
 | 
				
			||||||
							
								
								
									
										1756
									
								
								apps/gpgui-helper/src-tauri/gen/schemas/desktop-schema.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1756
									
								
								apps/gpgui-helper/src-tauri/gen/schemas/desktop-schema.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1756
									
								
								apps/gpgui-helper/src-tauri/gen/schemas/linux-schema.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1756
									
								
								apps/gpgui-helper/src-tauri/gen/schemas/linux-schema.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,8 +1,7 @@
 | 
				
			|||||||
use std::sync::Arc;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use gpapi::utils::window::WindowExt;
 | 
					 | 
				
			||||||
use log::info;
 | 
					use log::info;
 | 
				
			||||||
use tauri::Manager;
 | 
					use tauri::{Listener, Manager};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::updater::{GuiUpdater, Installer, ProgressNotifier};
 | 
					use crate::updater::{GuiUpdater, Installer, ProgressNotifier};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,15 +24,15 @@ impl App {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    tauri::Builder::default()
 | 
					    tauri::Builder::default()
 | 
				
			||||||
      .setup(move |app| {
 | 
					      .setup(move |app| {
 | 
				
			||||||
        let win = app.get_window("main").expect("no main window");
 | 
					        let win = app.get_webview_window("main").expect("no main window");
 | 
				
			||||||
        win.hide_menu();
 | 
					        let _ = win.hide_menu();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let notifier = ProgressNotifier::new(win.clone());
 | 
					        let notifier = ProgressNotifier::new(win.clone());
 | 
				
			||||||
        let installer = Installer::new(api_key);
 | 
					        let installer = Installer::new(api_key);
 | 
				
			||||||
        let updater = Arc::new(GuiUpdater::new(gui_version, notifier, installer));
 | 
					        let updater = Arc::new(GuiUpdater::new(gui_version, notifier, installer));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let win_clone = win.clone();
 | 
					        let win_clone = win.clone();
 | 
				
			||||||
        app.listen_global("app://update-done", move |_event| {
 | 
					        app.listen_any("app://update-done", move |_event| {
 | 
				
			||||||
          info!("Update done");
 | 
					          info!("Update done");
 | 
				
			||||||
          let _ = win_clone.close();
 | 
					          let _ = win_clone.close();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -41,12 +40,15 @@ impl App {
 | 
				
			|||||||
        // Listen for the update event
 | 
					        // Listen for the update event
 | 
				
			||||||
        win.listen("app://update", move |_event| {
 | 
					        win.listen("app://update", move |_event| {
 | 
				
			||||||
          let updater = Arc::clone(&updater);
 | 
					          let updater = Arc::clone(&updater);
 | 
				
			||||||
 | 
					          if updater.is_in_progress() {
 | 
				
			||||||
 | 
					            info!("Update already in progress");
 | 
				
			||||||
 | 
					            updater.notify_progress();
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          tokio::spawn(async move { updater.update().await });
 | 
					          tokio::spawn(async move { updater.update().await });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Update the GUI on startup
 | 
					 | 
				
			||||||
        win.trigger("app://update", None);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .run(tauri::generate_context!())?;
 | 
					      .run(tauri::generate_context!())?;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
use clap::Parser;
 | 
					use clap::Parser;
 | 
				
			||||||
use gpapi::utils::base64;
 | 
					use gpapi::utils::{base64, env_utils};
 | 
				
			||||||
use log::{info, LevelFilter};
 | 
					use log::{info, LevelFilter};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::app::App;
 | 
					use crate::app::App;
 | 
				
			||||||
@@ -22,6 +22,8 @@ impl Cli {
 | 
				
			|||||||
    let api_key = self.read_api_key()?;
 | 
					    let api_key = self.read_api_key()?;
 | 
				
			||||||
    let app = App::new(api_key, &self.gui_version);
 | 
					    let app = App::new(api_key, &self.gui_version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    env_utils::patch_gui_runtime_env(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.run()
 | 
					    app.run()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,39 +1,39 @@
 | 
				
			|||||||
use std::sync::Arc;
 | 
					use std::sync::{Arc, RwLock};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use gpapi::{
 | 
					use gpapi::{
 | 
				
			||||||
  service::request::UpdateGuiRequest,
 | 
					  service::request::UpdateGuiRequest,
 | 
				
			||||||
  utils::{checksum::verify_checksum, crypto::Crypto, endpoint::http_endpoint},
 | 
					  utils::{checksum::verify_checksum, crypto::Crypto, endpoint::http_endpoint},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use log::{info, warn};
 | 
					use log::{info, warn};
 | 
				
			||||||
use tauri::{Manager, Window};
 | 
					use tauri::{Emitter, WebviewWindow};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::downloader::{ChecksumFetcher, FileDownloader};
 | 
					use crate::downloader::{ChecksumFetcher, FileDownloader};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(not(debug_assertions))]
 | 
					#[cfg(not(debug_assertions))]
 | 
				
			||||||
const SNAPSHOT: &str = match option_env!("SNAPSHOT") {
 | 
					const SNAPSHOT: &str = match option_env!("SNAPSHOT") {
 | 
				
			||||||
  Some(val) => val,
 | 
					  Some(val) => val,
 | 
				
			||||||
    None => "false"
 | 
					  None => "false",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub struct ProgressNotifier {
 | 
					pub struct ProgressNotifier {
 | 
				
			||||||
  win: Window,
 | 
					  win: WebviewWindow,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ProgressNotifier {
 | 
					impl ProgressNotifier {
 | 
				
			||||||
  pub fn new(win: Window) -> Self {
 | 
					  pub fn new(win: WebviewWindow) -> Self {
 | 
				
			||||||
    Self { win }
 | 
					    Self { win }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fn notify(&self, progress: Option<f64>) {
 | 
					  fn notify(&self, progress: Option<f64>) {
 | 
				
			||||||
    let _ = self.win.emit_all("app://update-progress", progress);
 | 
					    let _ = self.win.emit("app://update-progress", progress);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fn notify_error(&self) {
 | 
					  fn notify_error(&self) {
 | 
				
			||||||
    let _ = self.win.emit_all("app://update-error", ());
 | 
					    let _ = self.win.emit("app://update-error", ());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fn notify_done(&self) {
 | 
					  fn notify_done(&self) {
 | 
				
			||||||
    let _ = self.win.emit_and_trigger("app://update-done", ());
 | 
					    let _ = self.win.emit("app://update-done", ());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,6 +72,8 @@ pub struct GuiUpdater {
 | 
				
			|||||||
  version: String,
 | 
					  version: String,
 | 
				
			||||||
  notifier: Arc<ProgressNotifier>,
 | 
					  notifier: Arc<ProgressNotifier>,
 | 
				
			||||||
  installer: Installer,
 | 
					  installer: Installer,
 | 
				
			||||||
 | 
					  in_progress: RwLock<bool>,
 | 
				
			||||||
 | 
					  progress: Arc<RwLock<Option<f64>>>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl GuiUpdater {
 | 
					impl GuiUpdater {
 | 
				
			||||||
@@ -80,6 +82,8 @@ impl GuiUpdater {
 | 
				
			|||||||
      version,
 | 
					      version,
 | 
				
			||||||
      notifier: Arc::new(notifier),
 | 
					      notifier: Arc::new(notifier),
 | 
				
			||||||
      installer,
 | 
					      installer,
 | 
				
			||||||
 | 
					      in_progress: Default::default(),
 | 
				
			||||||
 | 
					      progress: Default::default(),
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -112,15 +116,23 @@ impl GuiUpdater {
 | 
				
			|||||||
    let cf = ChecksumFetcher::new(&checksum_url);
 | 
					    let cf = ChecksumFetcher::new(&checksum_url);
 | 
				
			||||||
    let notifier = Arc::clone(&self.notifier);
 | 
					    let notifier = Arc::clone(&self.notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dl.on_progress(move |progress| notifier.notify(progress));
 | 
					    let progress_ref = Arc::clone(&self.progress);
 | 
				
			||||||
 | 
					    dl.on_progress(move |progress| {
 | 
				
			||||||
 | 
					      // Save progress to shared state so that it can be notified to the UI when needed
 | 
				
			||||||
 | 
					      if let Ok(mut guard) = progress_ref.try_write() {
 | 
				
			||||||
 | 
					        *guard = progress;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      notifier.notify(progress);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    self.set_in_progress(true);
 | 
				
			||||||
    let res = tokio::try_join!(dl.download(), cf.fetch());
 | 
					    let res = tokio::try_join!(dl.download(), cf.fetch());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let (file, checksum) = match res {
 | 
					    let (file, checksum) = match res {
 | 
				
			||||||
      Ok((file, checksum)) => (file, checksum),
 | 
					      Ok((file, checksum)) => (file, checksum),
 | 
				
			||||||
      Err(err) => {
 | 
					      Err(err) => {
 | 
				
			||||||
        warn!("Download error: {}", err);
 | 
					        warn!("Download error: {}", err);
 | 
				
			||||||
        self.notifier.notify_error();
 | 
					        self.notify_error();
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
@@ -130,7 +142,7 @@ impl GuiUpdater {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if let Err(err) = verify_checksum(&file_path, &checksum) {
 | 
					    if let Err(err) = verify_checksum(&file_path, &checksum) {
 | 
				
			||||||
      warn!("Checksum error: {}", err);
 | 
					      warn!("Checksum error: {}", err);
 | 
				
			||||||
      self.notifier.notify_error();
 | 
					      self.notify_error();
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -138,10 +150,48 @@ impl GuiUpdater {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if let Err(err) = self.installer.install(&file_path, &checksum).await {
 | 
					    if let Err(err) = self.installer.install(&file_path, &checksum).await {
 | 
				
			||||||
      warn!("Install error: {}", err);
 | 
					      warn!("Install error: {}", err);
 | 
				
			||||||
      self.notifier.notify_error();
 | 
					      self.notify_error();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      info!("Install success");
 | 
					      info!("Install success");
 | 
				
			||||||
 | 
					      self.notify_done();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pub fn is_in_progress(&self) -> bool {
 | 
				
			||||||
 | 
					    if let Ok(guard) = self.in_progress.try_read() {
 | 
				
			||||||
 | 
					      *guard
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      info!("Failed to acquire in_progress lock");
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fn set_in_progress(&self, in_progress: bool) {
 | 
				
			||||||
 | 
					    if let Ok(mut guard) = self.in_progress.try_write() {
 | 
				
			||||||
 | 
					      *guard = in_progress;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      info!("Failed to acquire in_progress lock");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fn notify_error(&self) {
 | 
				
			||||||
 | 
					    self.set_in_progress(false);
 | 
				
			||||||
 | 
					    self.notifier.notify_error();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fn notify_done(&self) {
 | 
				
			||||||
 | 
					    self.set_in_progress(false);
 | 
				
			||||||
    self.notifier.notify_done();
 | 
					    self.notifier.notify_done();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pub fn notify_progress(&self) {
 | 
				
			||||||
 | 
					    let progress = if let Ok(guard) = self.progress.try_read() {
 | 
				
			||||||
 | 
					      *guard
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      info!("Failed to acquire progress lock");
 | 
				
			||||||
 | 
					      None
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    self.notifier.notify(progress);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +1,15 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "$schema": "../node_modules/@tauri-apps/cli/schema.json",
 | 
					  "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
 | 
				
			||||||
  "build": {
 | 
					  "build": {
 | 
				
			||||||
    "beforeDevCommand": "pnpm dev",
 | 
					    "beforeDevCommand": "pnpm dev",
 | 
				
			||||||
    "beforeBuildCommand": "pnpm build",
 | 
					    "beforeBuildCommand": "pnpm build",
 | 
				
			||||||
    "devPath": "http://localhost:1421",
 | 
					    "devUrl": "http://localhost:1421",
 | 
				
			||||||
    "distDir": "../dist",
 | 
					    "frontendDist": "../dist"
 | 
				
			||||||
    "withGlobalTauri": false
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "package": {
 | 
					 | 
				
			||||||
    "productName": "gpgui-helper"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "tauri": {
 | 
					 | 
				
			||||||
    "allowlist": {
 | 
					 | 
				
			||||||
      "all": false,
 | 
					 | 
				
			||||||
      "window": {
 | 
					 | 
				
			||||||
        "all": false,
 | 
					 | 
				
			||||||
        "startDragging": true
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "bundle": {
 | 
					 | 
				
			||||||
      "active": false,
 | 
					 | 
				
			||||||
      "targets": "deb",
 | 
					 | 
				
			||||||
  "identifier": "com.yuezk.gpgui-helper",
 | 
					  "identifier": "com.yuezk.gpgui-helper",
 | 
				
			||||||
      "icon": [
 | 
					  "productName": "gpgui-helper",
 | 
				
			||||||
        "icons/32x32.png",
 | 
					  "app": {
 | 
				
			||||||
        "icons/128x128.png",
 | 
					    "withGlobalTauri": false,
 | 
				
			||||||
        "icons/128x128@2x.png",
 | 
					 | 
				
			||||||
        "icons/icon.icns",
 | 
					 | 
				
			||||||
        "icons/icon.ico"
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "security": {
 | 
					    "security": {
 | 
				
			||||||
      "csp": null
 | 
					      "csp": null
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -48,5 +28,16 @@
 | 
				
			|||||||
        "decorations": false
 | 
					        "decorations": false
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "bundle": {
 | 
				
			||||||
 | 
					    "active": false,
 | 
				
			||||||
 | 
					    "targets": "deb",
 | 
				
			||||||
 | 
					    "icon": [
 | 
				
			||||||
 | 
					      "icons/32x32.png",
 | 
				
			||||||
 | 
					      "icons/128x128.png",
 | 
				
			||||||
 | 
					      "icons/128x128@2x.png",
 | 
				
			||||||
 | 
					      "icons/icon.icns",
 | 
				
			||||||
 | 
					      "icons/icon.ico"
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,12 @@
 | 
				
			|||||||
import { Box, Button, CssBaseline, LinearProgress, Typography } from "@mui/material";
 | 
					import { Box, Button, CssBaseline, LinearProgress, Typography } from "@mui/material";
 | 
				
			||||||
import { appWindow } from "@tauri-apps/api/window";
 | 
					import { getCurrentWindow } from "@tauri-apps/api/window";
 | 
				
			||||||
import logo from "../../assets/icon.svg";
 | 
					import logo from "../../assets/icon.svg";
 | 
				
			||||||
import { useEffect, useState } from "react";
 | 
					import { useEffect, useState } from "react";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "./styles.css";
 | 
					import "./styles.css";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const appWindow = getCurrentWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function useUpdateProgress() {
 | 
					function useUpdateProgress() {
 | 
				
			||||||
  const [progress, setProgress] = useState<number | null>(null);
 | 
					  const [progress, setProgress] = useState<number | null>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,6 +27,8 @@ export default function App() {
 | 
				
			|||||||
  const [error, setError] = useState(false);
 | 
					  const [error, setError] = useState(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
 | 
					    appWindow.emit("app://update");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const unlisten = appWindow.listen("app://update-error", () => {
 | 
					    const unlisten = appWindow.listen("app://update-error", () => {
 | 
				
			||||||
      setError(true);
 | 
					      setError(true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ use clap::Parser;
 | 
				
			|||||||
use gpapi::{
 | 
					use gpapi::{
 | 
				
			||||||
  process::gui_launcher::GuiLauncher,
 | 
					  process::gui_launcher::GuiLauncher,
 | 
				
			||||||
  service::{request::WsRequest, vpn_state::VpnState},
 | 
					  service::{request::WsRequest, vpn_state::VpnState},
 | 
				
			||||||
  utils::{crypto::generate_key, env_file, lock_file::LockFile, redact::Redaction, shutdown_signal},
 | 
					  utils::{crypto::generate_key, env_utils, lock_file::LockFile, redact::Redaction, shutdown_signal},
 | 
				
			||||||
  GP_SERVICE_LOCK_FILE,
 | 
					  GP_SERVICE_LOCK_FILE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use log::{info, warn, LevelFilter};
 | 
					use log::{info, warn, LevelFilter};
 | 
				
			||||||
@@ -63,7 +63,7 @@ impl Cli {
 | 
				
			|||||||
    if no_gui {
 | 
					    if no_gui {
 | 
				
			||||||
      info!("GUI is disabled");
 | 
					      info!("GUI is disabled");
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      let envs = self.env_file.as_ref().map(env_file::load_env_vars).transpose()?;
 | 
					      let envs = self.env_file.as_ref().map(env_utils::load_env_vars).transpose()?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let minimized = self.minimized;
 | 
					      let minimized = self.minimized;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,7 @@ openssl.workspace = true
 | 
				
			|||||||
pem.workspace = true
 | 
					pem.workspace = true
 | 
				
			||||||
roxmltree.workspace = true
 | 
					roxmltree.workspace = true
 | 
				
			||||||
serde.workspace = true
 | 
					serde.workspace = true
 | 
				
			||||||
specta.workspace = true
 | 
					specta = { workspace = true, features = ["derive"] }
 | 
				
			||||||
specta-macros.workspace = true
 | 
					 | 
				
			||||||
urlencoding.workspace = true
 | 
					urlencoding.workspace = true
 | 
				
			||||||
tokio.workspace = true
 | 
					tokio.workspace = true
 | 
				
			||||||
serde_json.workspace = true
 | 
					serde_json.workspace = true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ use std::collections::HashMap;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use anyhow::bail;
 | 
					use anyhow::bail;
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::auth::{SamlAuthData, SamlAuthResult};
 | 
					use crate::auth::{SamlAuthData, SamlAuthResult};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ pub use login::*;
 | 
				
			|||||||
pub(crate) use parse_gateways::*;
 | 
					pub(crate) use parse_gateways::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::fmt::Display;
 | 
					use std::fmt::Display;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ use std::collections::HashMap;
 | 
				
			|||||||
use log::info;
 | 
					use log::info;
 | 
				
			||||||
use reqwest::Client;
 | 
					use reqwest::Client;
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::{utils::request::create_identity, GP_USER_AGENT};
 | 
					use crate::{utils::request::create_identity, GP_USER_AGENT};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ use log::{debug, info, warn};
 | 
				
			|||||||
use reqwest::{Client, StatusCode};
 | 
					use reqwest::{Client, StatusCode};
 | 
				
			||||||
use roxmltree::{Document, Node};
 | 
					use roxmltree::{Document, Node};
 | 
				
			||||||
use serde::Serialize;
 | 
					use serde::Serialize;
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::{
 | 
					use crate::{
 | 
				
			||||||
  credential::{AuthCookieCredential, Credential},
 | 
					  credential::{AuthCookieCredential, Credential},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ use log::{info, warn};
 | 
				
			|||||||
use reqwest::{Client, StatusCode};
 | 
					use reqwest::{Client, StatusCode};
 | 
				
			||||||
use roxmltree::Document;
 | 
					use roxmltree::Document;
 | 
				
			||||||
use serde::Serialize;
 | 
					use serde::Serialize;
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::{
 | 
					use crate::{
 | 
				
			||||||
  error::PortalError,
 | 
					  error::PortalError,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
use std::collections::HashMap;
 | 
					use std::collections::HashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::{gateway::Gateway, gp_params::ClientOs};
 | 
					use crate::{gateway::Gateway, gp_params::ClientOs};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use specta_macros::Type;
 | 
					use specta::Type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::gateway::Gateway;
 | 
					use crate::gateway::Gateway;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ use std::env;
 | 
				
			|||||||
use std::io::Write;
 | 
					use std::io::Write;
 | 
				
			||||||
use std::path::Path;
 | 
					use std::path::Path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use log::info;
 | 
				
			||||||
use tempfile::NamedTempFile;
 | 
					use tempfile::NamedTempFile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn persist_env_vars(extra: Option<HashMap<String, String>>) -> anyhow::Result<NamedTempFile> {
 | 
					pub fn persist_env_vars(extra: Option<HashMap<String, String>>) -> anyhow::Result<NamedTempFile> {
 | 
				
			||||||
@@ -35,3 +36,20 @@ pub fn load_env_vars<T: AsRef<Path>>(env_file: T) -> anyhow::Result<HashMap<Stri
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  Ok(env_vars)
 | 
					  Ok(env_vars)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub fn patch_gui_runtime_env(hidpi: bool) {
 | 
				
			||||||
 | 
					  // This is to avoid blank screen on some systems
 | 
				
			||||||
 | 
					  std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Workaround for https://github.com/tauri-apps/tao/issues/929
 | 
				
			||||||
 | 
					  let desktop = env::var("XDG_CURRENT_DESKTOP").unwrap_or_default().to_lowercase();
 | 
				
			||||||
 | 
					  if desktop.contains("gnome") {
 | 
				
			||||||
 | 
					    env::set_var("GDK_BACKEND", "x11");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if hidpi {
 | 
				
			||||||
 | 
					    info!("Setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5");
 | 
				
			||||||
 | 
					    std::env::set_var("GDK_SCALE", "2");
 | 
				
			||||||
 | 
					    std::env::set_var("GDK_DPI_SCALE", "0.5");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -4,7 +4,7 @@ pub mod base64;
 | 
				
			|||||||
pub mod checksum;
 | 
					pub mod checksum;
 | 
				
			||||||
pub mod crypto;
 | 
					pub mod crypto;
 | 
				
			||||||
pub mod endpoint;
 | 
					pub mod endpoint;
 | 
				
			||||||
pub mod env_file;
 | 
					pub mod env_utils;
 | 
				
			||||||
pub mod lock_file;
 | 
					pub mod lock_file;
 | 
				
			||||||
pub mod openssl;
 | 
					pub mod openssl;
 | 
				
			||||||
pub mod redact;
 | 
					pub mod redact;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ use std::{process::ExitStatus, time::Duration};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use anyhow::bail;
 | 
					use anyhow::bail;
 | 
				
			||||||
use log::info;
 | 
					use log::info;
 | 
				
			||||||
use tauri::Window;
 | 
					use tauri::WebviewWindow;
 | 
				
			||||||
use tokio::process::Command;
 | 
					use tokio::process::Command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub trait WindowExt {
 | 
					pub trait WindowExt {
 | 
				
			||||||
@@ -10,7 +10,7 @@ pub trait WindowExt {
 | 
				
			|||||||
  fn hide_menu(&self);
 | 
					  fn hide_menu(&self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl WindowExt for Window {
 | 
					impl WindowExt for WebviewWindow {
 | 
				
			||||||
  fn raise(&self) -> anyhow::Result<()> {
 | 
					  fn raise(&self) -> anyhow::Result<()> {
 | 
				
			||||||
    raise_window(self)
 | 
					    raise_window(self)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -20,7 +20,7 @@ impl WindowExt for Window {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn raise_window(win: &Window) -> anyhow::Result<()> {
 | 
					pub fn raise_window(win: &WebviewWindow) -> anyhow::Result<()> {
 | 
				
			||||||
  let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland";
 | 
					  let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if is_wayland {
 | 
					  if is_wayland {
 | 
				
			||||||
@@ -77,7 +77,7 @@ async fn wmctrl_try_raise_window(title: &str) -> anyhow::Result<ExitStatus> {
 | 
				
			|||||||
  Ok(exit_status)
 | 
					  Ok(exit_status)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn hide_menu(win: &Window) {
 | 
					fn hide_menu(win: &WebviewWindow) {
 | 
				
			||||||
  // let menu_handle = win.menu_handle();
 | 
					  // let menu_handle = win.menu_handle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // tokio::spawn(async move {
 | 
					  // tokio::spawn(async move {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user