fix: add proxy URL support to Webview at Rust-side. (#13278)

* fix: add proxy URL support to Webview

* chore: add .changes file

* Change file
This commit is contained in:
situ2001
2025-04-23 09:38:43 +08:00
committed by GitHub
parent 267368fd4f
commit 76cbeef208
2 changed files with 9 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
'tauri': 'patch:bug'
---
Fix JavaScript API `Webview.proxyUrl` had no effect when used in the `Webview` constructor

View File

@@ -15,6 +15,7 @@ mod desktop_commands {
use serde::{Deserialize, Serialize};
use tauri_runtime::dpi::{Position, Size};
use tauri_utils::config::{BackgroundThrottlingPolicy, WebviewUrl, WindowConfig};
use url::Url;
use super::*;
use crate::{
@@ -46,6 +47,8 @@ mod desktop_commands {
window_effects: Option<WindowEffectsConfig>,
#[serde(default)]
incognito: bool,
#[serde(alias = "proxy-url")]
pub proxy_url: Option<Url>,
#[serde(default)]
zoom_hotkeys_enabled: bool,
#[serde(default)]
@@ -70,6 +73,7 @@ mod desktop_commands {
builder.webview_attributes.accept_first_mouse = config.accept_first_mouse;
builder.webview_attributes.window_effects = config.window_effects;
builder.webview_attributes.incognito = config.incognito;
builder.webview_attributes.proxy_url = config.proxy_url;
builder.webview_attributes.zoom_hotkeys_enabled = config.zoom_hotkeys_enabled;
builder.webview_attributes.background_throttling = config.background_throttling;
builder.webview_attributes.javascript_disabled = config.javascript_disabled;