fix: restore GUI callback desktop handler

This commit is contained in:
Kevin Yue committed 2026-08-07 17:11:29 +08:00
1 parent c92bdaed1d
commit 581710a770
12 files changed
+202 -45

No files matched your search

+4 -4
View File
@@ -97,7 +97,7 @@ pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
const MIME_TYPE: &str = "x-scheme-handler/globalprotectcallback";
const HANDLER: &str = "gpauth.desktop";
const HANDLER: &str = "gpgui.desktop";
let current_handler = query_callback_handler(MIME_TYPE)?;
if !should_register_handler(&current_handler) {
@@ -147,7 +147,7 @@ pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
fn should_register_handler(current_handler: &str) -> bool {
current_handler != "gpauth.desktop"
current_handler != "gpgui.desktop"
}
async fn forward_auth_callback_to(callback: &str, socket_path: &Path) -> anyhow::Result<()> {
@@ -334,9 +334,9 @@ mod tests {
#[test]
fn replaces_any_other_callback_handler() {
assert!(!should_register_handler("gpauth.desktop"));
assert!(!should_register_handler("gpgui.desktop"));
assert!(should_register_handler(""));
assert!(should_register_handler("gpgui.desktop"));
assert!(should_register_handler("gpauth.desktop"));
assert!(should_register_handler("other-vpn.desktop"));
}