refactor: support proxy option

This commit is contained in:
jeasonnow
2024-07-30 16:54:36 +08:00
parent a631e117ca
commit 5752996f89
7 changed files with 17 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
use crate::app::config::PakeConfig;
use std::path::PathBuf;
use tauri::{App, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
use std::{path::PathBuf, str::FromStr};
use tauri::{App, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
#[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
@@ -40,6 +40,11 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
//This is necessary to allow for file injection by external developers for customization purposes.
.initialization_script(include_str!("../inject/custom.js"));
if config.proxy_url != "" {
println!("{}", &config.proxy_url);
window_builder = window_builder.proxy_url(Url::from_str(&config.proxy_url.as_str()).unwrap());
}
#[cfg(target_os = "macos")]
{
let title_bar_style = if window_config.hide_title_bar {