Fix the user agent of auth window

This commit is contained in:
Kevin Yue 2024-01-18 20:13:06 +08:00
parent 04a916a3e1
commit bc8dc7a4f3

View File

@ -18,8 +18,8 @@ use tokio_util::sync::CancellationToken;
use webkit2gtk::{ use webkit2gtk::{
gio::Cancellable, gio::Cancellable,
glib::{GString, TimeSpan}, glib::{GString, TimeSpan},
LoadEvent, URIResponse, URIResponseExt, WebContextExt, WebResource, WebResourceExt, WebView, LoadEvent, SettingsExt, URIResponse, URIResponseExt, WebContextExt, WebResource, WebResourceExt,
WebViewExt, WebsiteDataManagerExtManual, WebsiteDataTypes, WebView, WebViewExt, WebsiteDataManagerExtManual, WebsiteDataTypes,
}; };
enum AuthDataError { enum AuthDataError {
@ -76,7 +76,7 @@ impl<'a> AuthWindow<'a> {
let window = Window::builder(&self.app_handle, "auth_window", WindowUrl::default()) let window = Window::builder(&self.app_handle, "auth_window", WindowUrl::default())
.title("GlobalProtect Login") .title("GlobalProtect Login")
.user_agent(self.user_agent) // .user_agent(self.user_agent)
.focused(true) .focused(true)
.visible(false) .visible(false)
.center() .center()
@ -128,6 +128,11 @@ impl<'a> AuthWindow<'a> {
window.with_webview(move |wv| { window.with_webview(move |wv| {
let wv = wv.inner(); let wv = wv.inner();
if let Some(settings) = wv.settings() {
let ua = settings.user_agent().unwrap_or("".into());
info!("Auth window user agent: {}", ua);
}
// Load the initial SAML request // Load the initial SAML request
load_saml_request(&wv, &saml_request); load_saml_request(&wv, &saml_request);