mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
refactor: align GP profile and packaging flow
Main changes: - Refactor connect/auth flows around a single OS profile and host identity model, including gateway fallback and cookie-on-stdin handling. - Align request parameters, HIP host-id propagation, SAML webview user-agent behavior, and portal default-browser handling with observed official client behavior. - Add opt-in cookie cache support and Microsoft Defender HIP reporting while keeping host-id validation explicit. - Add BSD build, packaging, release artifact, and provenance support with FreeBSD/OpenBSD path and dependency cleanup. - Update NixOS install documentation and dependency compatibility fixes.
This commit is contained in:
92 files changed
+9847
-2868
No files matched your search
@@ -24,26 +24,49 @@ mod unix {
|
||||
use anyhow::bail;
|
||||
use gtk::{
|
||||
EventBox,
|
||||
glib::Cast,
|
||||
glib::{self, Cast},
|
||||
traits::{EventBoxExt, GtkWindowExt, WidgetExt},
|
||||
};
|
||||
use log::info;
|
||||
use tauri::WebviewWindow;
|
||||
use tokio::process::Command;
|
||||
|
||||
/// Wrapper to mark a non-Send closure as Send for dispatch to the GTK main thread.
|
||||
///
|
||||
/// SAFETY: The caller must ensure the closure is only executed on the GTK main
|
||||
/// thread. This is guaranteed by `glib::MainContext::default().invoke()`.
|
||||
struct SendFn(Box<dyn FnOnce()>);
|
||||
unsafe impl Send for SendFn {}
|
||||
|
||||
impl SendFn {
|
||||
fn invoke(self) {
|
||||
(self.0)();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn raise_window(win: &WebviewWindow) -> anyhow::Result<()> {
|
||||
let is_wayland = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "wayland";
|
||||
|
||||
if is_wayland {
|
||||
let gtk_win = win.gtk_window()?;
|
||||
if let Some(header) = gtk_win.titlebar() {
|
||||
let _ = header.downcast::<EventBox>().map(|event_box| {
|
||||
event_box.set_above_child(false);
|
||||
});
|
||||
}
|
||||
|
||||
gtk_win.hide();
|
||||
gtk_win.show_all();
|
||||
// GTK operations must run on the main thread. When this function is called
|
||||
// from a background thread (e.g., rspc handler on a tokio worker), calling
|
||||
// GTK widget methods directly causes crashes in GTK's CSS subsystem
|
||||
// (gtk_css_value_inherit_free assertion failure). Dispatch to the main
|
||||
// thread via glib::MainContext to ensure thread safety.
|
||||
let send_fn = SendFn(Box::new(move || {
|
||||
if let Some(header) = gtk_win.titlebar() {
|
||||
let _ = header.downcast::<EventBox>().map(|event_box| {
|
||||
event_box.set_above_child(false);
|
||||
});
|
||||
}
|
||||
|
||||
gtk_win.hide();
|
||||
gtk_win.show_all();
|
||||
}));
|
||||
|
||||
glib::MainContext::default().invoke(move || send_fn.invoke());
|
||||
} else {
|
||||
if !win.is_visible()? {
|
||||
win.show()?;
|
||||
|
||||
Reference in new issue
Block a user