mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-14 16:37:22 +02:00
feat(updater) support proxy (#891)
* add proxy support Signed-off-by: San Zhang <sanzhang@mail.com> * 1. change string to url for proxy type 2. add proxy option in js api Signed-off-by: San Zhang <sanzhang@mail.com> * fix fmt issue Signed-off-by: San Zhang <sanzhang@mail.com> * Update plugins/updater/guest-js/index.ts --------- Signed-off-by: San Zhang <sanzhang@mail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use std::{
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
time::Duration,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "event", content = "data")]
|
||||
@@ -42,6 +43,7 @@ pub(crate) async fn check<R: Runtime>(
|
||||
pending: State<'_, PendingUpdate>,
|
||||
headers: Option<Vec<(String, String)>>,
|
||||
timeout: Option<u64>,
|
||||
proxy: Option<String>,
|
||||
target: Option<String>,
|
||||
) -> Result<Metadata> {
|
||||
let mut builder = app.updater_builder();
|
||||
@@ -53,6 +55,10 @@ pub(crate) async fn check<R: Runtime>(
|
||||
if let Some(timeout) = timeout {
|
||||
builder = builder.timeout(Duration::from_secs(timeout));
|
||||
}
|
||||
if let Some(ref proxy) = proxy {
|
||||
let url = Url::parse(proxy.as_str())?;
|
||||
builder = builder.proxy(url);
|
||||
}
|
||||
if let Some(target) = target {
|
||||
builder = builder.target(target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user