refact: tls, native-tls fallback rustls-tls (#13263)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
259
src/common.rs
259
src/common.rs
@@ -13,6 +13,7 @@ use hbb_common::whoami;
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
anyhow::{anyhow, Context},
|
||||
async_recursion::async_recursion,
|
||||
bail, base64,
|
||||
bytes::Bytes,
|
||||
config::{
|
||||
@@ -27,6 +28,7 @@ use hbb_common::{
|
||||
socket_client,
|
||||
sodiumoxide::crypto::{box_, secretbox, sign},
|
||||
timeout,
|
||||
tls::{get_cached_tls_accept_invalid_cert, get_cached_tls_type, upsert_tls_cache, TlsType},
|
||||
tokio::{
|
||||
self,
|
||||
net::UdpSocket,
|
||||
@@ -36,7 +38,7 @@ use hbb_common::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
hbbs_http::create_http_client_async,
|
||||
hbbs_http::{create_http_client_async, get_url_for_tls},
|
||||
ui_interface::{get_option, set_option},
|
||||
};
|
||||
|
||||
@@ -908,15 +910,35 @@ pub fn check_software_update() {
|
||||
}
|
||||
}
|
||||
|
||||
// No need to check `danger_accept_invalid_cert` for now.
|
||||
// Because the url is always `https://api.rustdesk.com/version/latest`.
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn do_check_software_update() -> hbb_common::ResultType<()> {
|
||||
let (request, url) =
|
||||
hbb_common::version_check_request(hbb_common::VER_TYPE_RUSTDESK_CLIENT.to_string());
|
||||
let latest_release_response = create_http_client_async()
|
||||
.post(url)
|
||||
.json(&request)
|
||||
.send()
|
||||
.await?;
|
||||
let proxy_conf = Config::get_socks();
|
||||
let tls_url = get_url_for_tls(&url, &proxy_conf);
|
||||
let tls_type = get_cached_tls_type(tls_url);
|
||||
let is_tls_not_cached = tls_type.is_none();
|
||||
let tls_type = tls_type.unwrap_or(TlsType::Rustls);
|
||||
let client = create_http_client_async(tls_type, false);
|
||||
let latest_release_response = match client.post(&url).json(&request).send().await {
|
||||
Ok(resp) => {
|
||||
upsert_tls_cache(tls_url, tls_type, false);
|
||||
resp
|
||||
}
|
||||
Err(err) => {
|
||||
if is_tls_not_cached && err.is_request() {
|
||||
let tls_type = TlsType::NativeTls;
|
||||
let client = create_http_client_async(tls_type, false);
|
||||
let resp = client.post(&url).json(&request).send().await?;
|
||||
upsert_tls_cache(tls_url, tls_type, false);
|
||||
resp
|
||||
} else {
|
||||
return Err(err.into());
|
||||
}
|
||||
}
|
||||
};
|
||||
let bytes = latest_release_response.bytes().await?;
|
||||
let resp: hbb_common::VersionCheckResponse = serde_json::from_slice(&bytes)?;
|
||||
let response_url = resp.url;
|
||||
@@ -1067,7 +1089,38 @@ pub fn get_audit_server(api: String, custom: String, typ: String) -> String {
|
||||
}
|
||||
|
||||
pub async fn post_request(url: String, body: String, header: &str) -> ResultType<String> {
|
||||
let mut req = create_http_client_async().post(url);
|
||||
let proxy_conf = Config::get_socks();
|
||||
let tls_url = get_url_for_tls(&url, &proxy_conf);
|
||||
let tls_type = get_cached_tls_type(tls_url);
|
||||
let danger_accept_invalid_cert = get_cached_tls_accept_invalid_cert(tls_url);
|
||||
let response = post_request_(
|
||||
&url,
|
||||
tls_url,
|
||||
body.clone(),
|
||||
header,
|
||||
tls_type,
|
||||
danger_accept_invalid_cert,
|
||||
danger_accept_invalid_cert,
|
||||
)
|
||||
.await?;
|
||||
Ok(response.text().await?)
|
||||
}
|
||||
|
||||
#[async_recursion]
|
||||
async fn post_request_(
|
||||
url: &str,
|
||||
tls_url: &str,
|
||||
body: String,
|
||||
header: &str,
|
||||
tls_type: Option<TlsType>,
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
original_danger_accept_invalid_cert: Option<bool>,
|
||||
) -> ResultType<reqwest::Response> {
|
||||
let mut req = create_http_client_async(
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
)
|
||||
.post(url);
|
||||
if !header.is_empty() {
|
||||
let tmp: Vec<&str> = header.split(": ").collect();
|
||||
if tmp.len() == 2 {
|
||||
@@ -1076,7 +1129,66 @@ pub async fn post_request(url: String, body: String, header: &str) -> ResultType
|
||||
}
|
||||
req = req.header("Content-Type", "application/json");
|
||||
let to = std::time::Duration::from_secs(12);
|
||||
Ok(req.body(body).timeout(to).send().await?.text().await?)
|
||||
if tls_type.is_some() && danger_accept_invalid_cert.is_some() {
|
||||
// This branch is used to reduce a `clone()` when both `tls_type` and
|
||||
// `danger_accept_invalid_cert` are cached.
|
||||
match req.body(body.clone()).timeout(to).send().await {
|
||||
Ok(resp) => {
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
Ok(resp)
|
||||
}
|
||||
Err(e) => Err(anyhow!("{:?}", e)),
|
||||
}
|
||||
} else {
|
||||
match req.body(body.clone()).timeout(to).send().await {
|
||||
Ok(resp) => {
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
Ok(resp)
|
||||
}
|
||||
Err(e) => {
|
||||
if (tls_type.is_none() || danger_accept_invalid_cert.is_none()) && e.is_request() {
|
||||
if danger_accept_invalid_cert.is_none() {
|
||||
log::warn!(
|
||||
"HTTP request failed: {:?}, try again, danger accept invalid cert",
|
||||
e
|
||||
);
|
||||
post_request_(
|
||||
url,
|
||||
tls_url,
|
||||
body,
|
||||
header,
|
||||
tls_type,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
log::warn!("HTTP request failed: {:?}, try again with native-tls", e);
|
||||
post_request_(
|
||||
url,
|
||||
tls_url,
|
||||
body,
|
||||
header,
|
||||
Some(TlsType::NativeTls),
|
||||
original_danger_accept_invalid_cert,
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await
|
||||
}
|
||||
} else {
|
||||
Err(anyhow!("{:?}", e))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
@@ -1084,22 +1196,29 @@ pub async fn post_request_sync(url: String, body: String, header: &str) -> Resul
|
||||
post_request(url, body, header).await
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn http_request_sync(
|
||||
url: String,
|
||||
method: String,
|
||||
#[async_recursion]
|
||||
async fn get_http_response_async(
|
||||
url: &str,
|
||||
tls_url: &str,
|
||||
method: &str,
|
||||
body: Option<String>,
|
||||
header: String,
|
||||
) -> ResultType<String> {
|
||||
let http_client = create_http_client_async();
|
||||
let mut http_client = match method.as_str() {
|
||||
header: &str,
|
||||
tls_type: Option<TlsType>,
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
original_danger_accept_invalid_cert: Option<bool>,
|
||||
) -> ResultType<reqwest::Response> {
|
||||
let http_client = create_http_client_async(
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
let mut http_client = match method {
|
||||
"get" => http_client.get(url),
|
||||
"post" => http_client.post(url),
|
||||
"put" => http_client.put(url),
|
||||
"delete" => http_client.delete(url),
|
||||
_ => return Err(anyhow!("The HTTP request method is not supported!")),
|
||||
};
|
||||
let v = serde_json::from_str(header.as_str())?;
|
||||
let v = serde_json::from_str(header)?;
|
||||
|
||||
if let Value::Object(obj) = v {
|
||||
for (key, value) in obj.iter() {
|
||||
@@ -1109,15 +1228,105 @@ pub async fn http_request_sync(
|
||||
return Err(anyhow!("HTTP header information parsing failed!"));
|
||||
}
|
||||
|
||||
if let Some(b) = body {
|
||||
http_client = http_client.body(b);
|
||||
if tls_type.is_some() && danger_accept_invalid_cert.is_some() {
|
||||
if let Some(b) = body {
|
||||
http_client = http_client.body(b);
|
||||
}
|
||||
match http_client
|
||||
.timeout(std::time::Duration::from_secs(12))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(resp) => {
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
Ok(resp)
|
||||
}
|
||||
Err(e) => Err(anyhow!("{:?}", e)),
|
||||
}
|
||||
} else {
|
||||
if let Some(b) = body.clone() {
|
||||
http_client = http_client.body(b);
|
||||
}
|
||||
|
||||
match http_client
|
||||
.timeout(std::time::Duration::from_secs(12))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(resp) => {
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type.unwrap_or(TlsType::Rustls),
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
Ok(resp)
|
||||
}
|
||||
Err(e) => {
|
||||
if (tls_type.is_none() || danger_accept_invalid_cert.is_none()) && e.is_request() {
|
||||
if danger_accept_invalid_cert.is_none() {
|
||||
log::warn!(
|
||||
"HTTP request failed: {:?}, try again, danger accept invalid cert",
|
||||
e
|
||||
);
|
||||
get_http_response_async(
|
||||
url,
|
||||
tls_url,
|
||||
method,
|
||||
body,
|
||||
header,
|
||||
tls_type,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
log::warn!("HTTP request failed: {:?}, try again with native-tls", e);
|
||||
get_http_response_async(
|
||||
url,
|
||||
tls_url,
|
||||
method,
|
||||
body,
|
||||
header,
|
||||
Some(TlsType::NativeTls),
|
||||
original_danger_accept_invalid_cert,
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await
|
||||
}
|
||||
} else {
|
||||
Err(anyhow!("{:?}", e))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let response = http_client
|
||||
.timeout(std::time::Duration::from_secs(12))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn http_request_sync(
|
||||
url: String,
|
||||
method: String,
|
||||
body: Option<String>,
|
||||
header: String,
|
||||
) -> ResultType<String> {
|
||||
let proxy_conf = Config::get_socks();
|
||||
let tls_url = get_url_for_tls(&url, &proxy_conf);
|
||||
let tls_type = get_cached_tls_type(tls_url);
|
||||
let danger_accept_invalid_cert = get_cached_tls_accept_invalid_cert(tls_url);
|
||||
let response = get_http_response_async(
|
||||
&url,
|
||||
tls_url,
|
||||
&method,
|
||||
body.clone(),
|
||||
&header,
|
||||
tls_type,
|
||||
danger_accept_invalid_cert,
|
||||
danger_accept_invalid_cert,
|
||||
)
|
||||
.await?;
|
||||
// Serialize response headers
|
||||
let mut response_headers = serde_json::map::Map::new();
|
||||
for (key, value) in response.headers() {
|
||||
@@ -1772,7 +1981,7 @@ pub fn verify_login(_raw: &str, _id: &str) -> bool {
|
||||
|
||||
#[inline]
|
||||
pub fn is_udp_disabled() -> bool {
|
||||
get_builtin_option(keys::OPTION_DISABLE_UDP) == "Y"
|
||||
Config::get_option(keys::OPTION_DISABLE_UDP) == "Y"
|
||||
}
|
||||
|
||||
// this crate https://github.com/yoshd/stun-client supports nat type
|
||||
|
||||
@@ -951,10 +951,19 @@ pub fn main_set_option(key: String, value: String) {
|
||||
);
|
||||
}
|
||||
|
||||
if key.eq("custom-rendezvous-server")
|
||||
// If `is_allow_tls_fallback` and https proxy is used, we need to restart rendezvous mediator.
|
||||
// No need to check if https proxy is used, because this option does not change frequently
|
||||
// and restarting mediator is safe even https proxy is not used.
|
||||
let is_allow_tls_fallback = key.eq(config::keys::OPTION_ALLOW_INSECURE_TLS_FALLBACK);
|
||||
if is_allow_tls_fallback
|
||||
|| key.eq("custom-rendezvous-server")
|
||||
|| key.eq(config::keys::OPTION_ALLOW_WEBSOCKET)
|
||||
|| key.eq(config::keys::OPTION_DISABLE_UDP)
|
||||
|| key.eq("api-server")
|
||||
{
|
||||
if is_allow_tls_fallback {
|
||||
hbb_common::tls::reset_tls_cache();
|
||||
}
|
||||
set_option(key, value.clone());
|
||||
#[cfg(target_os = "android")]
|
||||
crate::rendezvous_mediator::RendezvousMediator::restart();
|
||||
@@ -2692,7 +2701,11 @@ pub fn session_get_common_sync(
|
||||
SyncReturn(session_get_common(session_id, key, param))
|
||||
}
|
||||
|
||||
pub fn session_get_common(session_id: SessionID, key: String, #[allow(unused_variables)] param: String) -> Option<String> {
|
||||
pub fn session_get_common(
|
||||
session_id: SessionID,
|
||||
key: String,
|
||||
#[allow(unused_variables)] param: String,
|
||||
) -> Option<String> {
|
||||
if let Some(s) = sessions::get_session_by_session_id(&session_id) {
|
||||
let v = if key == "is_screenshot_supported" {
|
||||
s.is_screenshot_supported().to_string()
|
||||
|
||||
@@ -4,12 +4,14 @@ use serde_json::{Map, Value};
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
pub mod account;
|
||||
pub mod downloader;
|
||||
mod http_client;
|
||||
pub mod record_upload;
|
||||
pub mod sync;
|
||||
pub mod downloader;
|
||||
pub use http_client::create_http_client;
|
||||
pub use http_client::create_http_client_async;
|
||||
pub use http_client::{
|
||||
create_http_client_async, create_http_client_async_with_url, create_http_client_with_url,
|
||||
get_url_for_tls,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum HbbHttpResponse<T> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::HbbHttpResponse;
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use crate::hbbs_http::create_http_client_with_url;
|
||||
use hbb_common::{config::LocalConfig, log, ResultType};
|
||||
use reqwest::blocking::Client;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@@ -104,7 +104,7 @@ pub struct AuthBody {
|
||||
}
|
||||
|
||||
pub struct OidcSession {
|
||||
client: Client,
|
||||
client: Option<Client>,
|
||||
state_msg: &'static str,
|
||||
failed_msg: String,
|
||||
code_url: Option<OidcAuthUrl>,
|
||||
@@ -131,7 +131,7 @@ impl Default for UserStatus {
|
||||
impl OidcSession {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
client: create_http_client(),
|
||||
client: None,
|
||||
state_msg: REQUESTING_ACCOUNT_AUTH,
|
||||
failed_msg: "".to_owned(),
|
||||
code_url: None,
|
||||
@@ -142,24 +142,36 @@ impl OidcSession {
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_client(api_server: &str) {
|
||||
let mut write_guard = OIDC_SESSION.write().unwrap();
|
||||
if write_guard.client.is_none() {
|
||||
// This URL is used to detect the appropriate TLS implementation for the server.
|
||||
let login_option_url = format!("{}/api/login-options", &api_server);
|
||||
let client = create_http_client_with_url(&login_option_url);
|
||||
write_guard.client = Some(client);
|
||||
}
|
||||
}
|
||||
|
||||
fn auth(
|
||||
api_server: &str,
|
||||
op: &str,
|
||||
id: &str,
|
||||
uuid: &str,
|
||||
) -> ResultType<HbbHttpResponse<OidcAuthUrl>> {
|
||||
let resp = OIDC_SESSION
|
||||
.read()
|
||||
.unwrap()
|
||||
.client
|
||||
.post(format!("{}/api/oidc/auth", api_server))
|
||||
.json(&serde_json::json!({
|
||||
"op": op,
|
||||
"id": id,
|
||||
"uuid": uuid,
|
||||
"deviceInfo": crate::ui_interface::get_login_device_info(),
|
||||
}))
|
||||
.send()?;
|
||||
Self::ensure_client(api_server);
|
||||
let resp = if let Some(client) = &OIDC_SESSION.read().unwrap().client {
|
||||
client
|
||||
.post(format!("{}/api/oidc/auth", api_server))
|
||||
.json(&serde_json::json!({
|
||||
"op": op,
|
||||
"id": id,
|
||||
"uuid": uuid,
|
||||
"deviceInfo": crate::ui_interface::get_login_device_info(),
|
||||
}))
|
||||
.send()?
|
||||
} else {
|
||||
hbb_common::bail!("http client not initialized");
|
||||
};
|
||||
let status = resp.status();
|
||||
match resp.try_into() {
|
||||
Ok(v) => Ok(v),
|
||||
@@ -179,13 +191,12 @@ impl OidcSession {
|
||||
&format!("{}/api/oidc/auth-query", api_server),
|
||||
&[("code", code), ("id", id), ("uuid", uuid)],
|
||||
)?;
|
||||
Ok(OIDC_SESSION
|
||||
.read()
|
||||
.unwrap()
|
||||
.client
|
||||
.get(url)
|
||||
.send()?
|
||||
.try_into()?)
|
||||
Self::ensure_client(api_server);
|
||||
if let Some(client) = &OIDC_SESSION.read().unwrap().client {
|
||||
Ok(client.get(url).send()?.try_into()?)
|
||||
} else {
|
||||
hbb_common::bail!("http client not initialized")
|
||||
}
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::create_http_client_async;
|
||||
use super::create_http_client_async_with_url;
|
||||
use hbb_common::{
|
||||
bail,
|
||||
lazy_static::lazy_static,
|
||||
@@ -132,7 +132,7 @@ async fn do_download(
|
||||
auto_del_dur: Option<Duration>,
|
||||
mut rx_cancel: UnboundedReceiver<()>,
|
||||
) -> ResultType<bool> {
|
||||
let client = create_http_client_async();
|
||||
let client = create_http_client_async_with_url(&url).await;
|
||||
|
||||
let mut is_all_downloaded = false;
|
||||
tokio::select! {
|
||||
|
||||
@@ -1,23 +1,49 @@
|
||||
use hbb_common::config::Config;
|
||||
use hbb_common::log::info;
|
||||
use hbb_common::proxy::{Proxy, ProxyScheme};
|
||||
use reqwest::blocking::Client as SyncClient;
|
||||
use reqwest::Client as AsyncClient;
|
||||
use hbb_common::{
|
||||
async_recursion::async_recursion,
|
||||
config::{Config, Socks5Server},
|
||||
log::{self, info},
|
||||
proxy::{Proxy, ProxyScheme},
|
||||
tls::{
|
||||
get_cached_tls_accept_invalid_cert, get_cached_tls_type, is_plain, upsert_tls_cache,
|
||||
TlsType,
|
||||
},
|
||||
};
|
||||
use reqwest::{blocking::Client as SyncClient, Client as AsyncClient};
|
||||
|
||||
macro_rules! configure_http_client {
|
||||
($builder:expr, $Client: ty) => {{
|
||||
($builder:expr, $tls_type:expr, $danger_accept_invalid_cert:expr, $Client: ty) => {{
|
||||
// https://github.com/rustdesk/rustdesk/issues/11569
|
||||
// https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.no_proxy
|
||||
let mut builder = $builder.no_proxy();
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
match hbb_common::verifier::client_config() {
|
||||
Ok(client_config) => {
|
||||
builder = builder.use_preconfigured_tls(client_config);
|
||||
|
||||
match $tls_type {
|
||||
TlsType::Plain => {}
|
||||
TlsType::NativeTls => {
|
||||
builder = builder.use_native_tls();
|
||||
if $danger_accept_invalid_cert {
|
||||
builder = builder.danger_accept_invalid_certs(true);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
hbb_common::log::error!("Failed to get client config: {}", e);
|
||||
TlsType::Rustls => {
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
match hbb_common::verifier::client_config($danger_accept_invalid_cert) {
|
||||
Ok(client_config) => {
|
||||
builder = builder.use_preconfigured_tls(client_config);
|
||||
}
|
||||
Err(e) => {
|
||||
hbb_common::log::error!("Failed to get client config: {}", e);
|
||||
}
|
||||
}
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
builder = builder.use_rustls_tls();
|
||||
if $danger_accept_invalid_cert {
|
||||
builder = builder.danger_accept_invalid_certs(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let client = if let Some(conf) = Config::get_socks() {
|
||||
let proxy_result = Proxy::from_conf(&conf, None);
|
||||
|
||||
@@ -70,12 +96,241 @@ macro_rules! configure_http_client {
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn create_http_client() -> SyncClient {
|
||||
pub fn create_http_client(tls_type: TlsType, danger_accept_invalid_cert: bool) -> SyncClient {
|
||||
let builder = SyncClient::builder();
|
||||
configure_http_client!(builder, SyncClient)
|
||||
configure_http_client!(builder, tls_type, danger_accept_invalid_cert, SyncClient)
|
||||
}
|
||||
|
||||
pub fn create_http_client_async() -> AsyncClient {
|
||||
pub fn create_http_client_async(
|
||||
tls_type: TlsType,
|
||||
danger_accept_invalid_cert: bool,
|
||||
) -> AsyncClient {
|
||||
let builder = AsyncClient::builder();
|
||||
configure_http_client!(builder, AsyncClient)
|
||||
configure_http_client!(builder, tls_type, danger_accept_invalid_cert, AsyncClient)
|
||||
}
|
||||
|
||||
pub fn get_url_for_tls<'a>(url: &'a str, proxy_conf: &'a Option<Socks5Server>) -> &'a str {
|
||||
if is_plain(url) {
|
||||
if let Some(conf) = proxy_conf {
|
||||
if conf.proxy.starts_with("https://") {
|
||||
return &conf.proxy;
|
||||
}
|
||||
}
|
||||
}
|
||||
url
|
||||
}
|
||||
|
||||
pub fn create_http_client_with_url(url: &str) -> SyncClient {
|
||||
let proxy_conf = Config::get_socks();
|
||||
let tls_url = get_url_for_tls(url, &proxy_conf);
|
||||
let tls_type = get_cached_tls_type(tls_url);
|
||||
let is_tls_type_cached = tls_type.is_some();
|
||||
let tls_type = tls_type.unwrap_or(TlsType::Rustls);
|
||||
let tls_danger_accept_invalid_cert = get_cached_tls_accept_invalid_cert(tls_url);
|
||||
create_http_client_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
tls_danger_accept_invalid_cert,
|
||||
tls_danger_accept_invalid_cert,
|
||||
)
|
||||
}
|
||||
|
||||
fn create_http_client_with_url_(
|
||||
url: &str,
|
||||
tls_url: &str,
|
||||
tls_type: TlsType,
|
||||
is_tls_type_cached: bool,
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
original_danger_accept_invalid_cert: Option<bool>,
|
||||
) -> SyncClient {
|
||||
let mut client = create_http_client(tls_type, danger_accept_invalid_cert.unwrap_or(false));
|
||||
if is_tls_type_cached && original_danger_accept_invalid_cert.is_some() {
|
||||
return client;
|
||||
}
|
||||
if let Err(e) = client.head(url).send() {
|
||||
if e.is_request() {
|
||||
match (tls_type, is_tls_type_cached, danger_accept_invalid_cert) {
|
||||
(TlsType::Rustls, _, None) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with rustls-tls: {:?}, trying accept invalid cert",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
);
|
||||
}
|
||||
(TlsType::Rustls, false, Some(_)) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with rustls-tls: {:?}, trying native-tls",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
TlsType::NativeTls,
|
||||
is_tls_type_cached,
|
||||
original_danger_accept_invalid_cert,
|
||||
original_danger_accept_invalid_cert,
|
||||
);
|
||||
}
|
||||
(TlsType::NativeTls, _, None) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with native-tls: {:?}, trying accept invalid cert",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
log::error!(
|
||||
"Failed to connect to server {} with {:?}, err: {:?}.",
|
||||
tls_url,
|
||||
tls_type,
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with {:?}, err: {}.",
|
||||
tls_url,
|
||||
tls_type,
|
||||
e
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log::info!(
|
||||
"Successfully connected to server {} with {:?}",
|
||||
tls_url,
|
||||
tls_type
|
||||
);
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type,
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
}
|
||||
client
|
||||
}
|
||||
|
||||
pub async fn create_http_client_async_with_url(url: &str) -> AsyncClient {
|
||||
let proxy_conf = Config::get_socks();
|
||||
let tls_url = get_url_for_tls(url, &proxy_conf);
|
||||
let tls_type = get_cached_tls_type(tls_url);
|
||||
let is_tls_type_cached = tls_type.is_some();
|
||||
let tls_type = tls_type.unwrap_or(TlsType::Rustls);
|
||||
let danger_accept_invalid_cert = get_cached_tls_accept_invalid_cert(tls_url);
|
||||
create_http_client_async_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
danger_accept_invalid_cert,
|
||||
danger_accept_invalid_cert,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[async_recursion]
|
||||
async fn create_http_client_async_with_url_(
|
||||
url: &str,
|
||||
tls_url: &str,
|
||||
tls_type: TlsType,
|
||||
is_tls_type_cached: bool,
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
original_danger_accept_invalid_cert: Option<bool>,
|
||||
) -> AsyncClient {
|
||||
let mut client =
|
||||
create_http_client_async(tls_type, danger_accept_invalid_cert.unwrap_or(false));
|
||||
if is_tls_type_cached && original_danger_accept_invalid_cert.is_some() {
|
||||
return client;
|
||||
}
|
||||
if let Err(e) = client.head(url).send().await {
|
||||
match (tls_type, is_tls_type_cached, danger_accept_invalid_cert) {
|
||||
(TlsType::Rustls, _, None) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with rustls-tls: {:?}, trying accept invalid cert",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_async_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
(TlsType::Rustls, false, Some(_)) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with rustls-tls: {:?}, trying native-tls",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_async_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
TlsType::NativeTls,
|
||||
is_tls_type_cached,
|
||||
original_danger_accept_invalid_cert,
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
(TlsType::NativeTls, _, None) => {
|
||||
log::warn!(
|
||||
"Failed to connect to server {} with native-tls: {:?}, trying accept invalid cert",
|
||||
tls_url,
|
||||
e
|
||||
);
|
||||
client = create_http_client_async_with_url_(
|
||||
url,
|
||||
tls_url,
|
||||
tls_type,
|
||||
is_tls_type_cached,
|
||||
Some(true),
|
||||
original_danger_accept_invalid_cert,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
_ => {
|
||||
log::error!(
|
||||
"Failed to connect to server {} with {:?}, err: {:?}.",
|
||||
tls_url,
|
||||
tls_type,
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::info!(
|
||||
"Successfully connected to server {} with {:?}",
|
||||
tls_url,
|
||||
tls_type
|
||||
);
|
||||
upsert_tls_cache(
|
||||
tls_url,
|
||||
tls_type,
|
||||
danger_accept_invalid_cert.unwrap_or(false),
|
||||
);
|
||||
}
|
||||
client
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use crate::hbbs_http::create_http_client_with_url;
|
||||
use bytes::Bytes;
|
||||
use hbb_common::{bail, config::Config, lazy_static, log, ResultType};
|
||||
use reqwest::blocking::{Body, Client};
|
||||
@@ -25,51 +25,57 @@ pub fn is_enable() -> bool {
|
||||
}
|
||||
|
||||
pub fn run(rx: Receiver<RecordState>) {
|
||||
let mut uploader = RecordUploader {
|
||||
client: create_http_client(),
|
||||
api_server: crate::get_api_server(
|
||||
std::thread::spawn(move || {
|
||||
let api_server = crate::get_api_server(
|
||||
Config::get_option("api-server"),
|
||||
Config::get_option("custom-rendezvous-server"),
|
||||
),
|
||||
filepath: Default::default(),
|
||||
filename: Default::default(),
|
||||
upload_size: Default::default(),
|
||||
running: Default::default(),
|
||||
last_send: Instant::now(),
|
||||
};
|
||||
std::thread::spawn(move || loop {
|
||||
if let Err(e) = match rx.recv() {
|
||||
Ok(state) => match state {
|
||||
RecordState::NewFile(filepath) => uploader.handle_new_file(filepath),
|
||||
RecordState::NewFrame => {
|
||||
if uploader.running {
|
||||
uploader.handle_frame(false)
|
||||
} else {
|
||||
Ok(())
|
||||
);
|
||||
// This URL is used for TLS connectivity testing and fallback detection.
|
||||
let login_option_url = format!("{}/api/login-options", &api_server);
|
||||
let client = create_http_client_with_url(&login_option_url);
|
||||
let mut uploader = RecordUploader {
|
||||
client,
|
||||
api_server,
|
||||
filepath: Default::default(),
|
||||
filename: Default::default(),
|
||||
upload_size: Default::default(),
|
||||
running: Default::default(),
|
||||
last_send: Instant::now(),
|
||||
};
|
||||
loop {
|
||||
if let Err(e) = match rx.recv() {
|
||||
Ok(state) => match state {
|
||||
RecordState::NewFile(filepath) => uploader.handle_new_file(filepath),
|
||||
RecordState::NewFrame => {
|
||||
if uploader.running {
|
||||
uploader.handle_frame(false)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
RecordState::WriteTail => {
|
||||
if uploader.running {
|
||||
uploader.handle_tail()
|
||||
} else {
|
||||
Ok(())
|
||||
RecordState::WriteTail => {
|
||||
if uploader.running {
|
||||
uploader.handle_tail()
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
RecordState::RemoveFile => {
|
||||
if uploader.running {
|
||||
uploader.handle_remove()
|
||||
} else {
|
||||
Ok(())
|
||||
RecordState::RemoveFile => {
|
||||
if uploader.running {
|
||||
uploader.handle_remove()
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::trace!("upload thread stop: {}", e);
|
||||
break;
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::trace!("upload thread stop: {}", e);
|
||||
break;
|
||||
} {
|
||||
uploader.running = false;
|
||||
log::error!("upload stop: {}", e);
|
||||
}
|
||||
} {
|
||||
uploader.running = false;
|
||||
log::error!("upload stop: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
18
src/ipc.rs
18
src/ipc.rs
@@ -363,6 +363,8 @@ pub struct CheckIfRestart {
|
||||
audio_input: String,
|
||||
voice_call_input: String,
|
||||
ws: String,
|
||||
disable_udp: String,
|
||||
allow_insecure_tls_fallback: String,
|
||||
api_server: String,
|
||||
}
|
||||
|
||||
@@ -374,17 +376,31 @@ impl CheckIfRestart {
|
||||
audio_input: Config::get_option("audio-input"),
|
||||
voice_call_input: Config::get_option("voice-call-input"),
|
||||
ws: Config::get_option(OPTION_ALLOW_WEBSOCKET),
|
||||
disable_udp: Config::get_option(config::keys::OPTION_DISABLE_UDP),
|
||||
allow_insecure_tls_fallback: Config::get_option(
|
||||
config::keys::OPTION_ALLOW_INSECURE_TLS_FALLBACK,
|
||||
),
|
||||
api_server: Config::get_option("api-server"),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Drop for CheckIfRestart {
|
||||
fn drop(&mut self) {
|
||||
if self.stop_service != Config::get_option("stop-service")
|
||||
// If https proxy is used, we need to restart rendezvous mediator.
|
||||
// No need to check if https proxy is used, because this option does not change frequently
|
||||
// and restarting mediator is safe even https proxy is not used.
|
||||
let allow_insecure_tls_fallback_changed = self.allow_insecure_tls_fallback
|
||||
!= Config::get_option(config::keys::OPTION_ALLOW_INSECURE_TLS_FALLBACK);
|
||||
if allow_insecure_tls_fallback_changed
|
||||
|| self.stop_service != Config::get_option("stop-service")
|
||||
|| self.rendezvous_servers != Config::get_rendezvous_servers()
|
||||
|| self.ws != Config::get_option(OPTION_ALLOW_WEBSOCKET)
|
||||
|| self.disable_udp != Config::get_option(config::keys::OPTION_DISABLE_UDP)
|
||||
|| self.api_server != Config::get_option("api-server")
|
||||
{
|
||||
if allow_insecure_tls_fallback_changed {
|
||||
hbb_common::tls::reset_tls_cache();
|
||||
}
|
||||
RendezvousMediator::restart();
|
||||
}
|
||||
if self.audio_input != Config::get_option("audio-input") {
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Edita la nota"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -721,6 +721,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Show virtual joystick", "显示虚拟摇杆"),
|
||||
("Edit note", "编辑备注"),
|
||||
("Alias", "别名"),
|
||||
("ScrollEdge", ""),
|
||||
("ScrollEdge", "边缘滚动"),
|
||||
("Allow insecure TLS fallback", "允许回退到不安全的 TLS 连接"),
|
||||
("allow-insecure-tls-fallback-tip", "默认情况下,对于使用 TLS 的协议,RustDesk 会验证服务器证书。\n启用此选项后,在验证失败时,RustDesk 将转为跳过验证步骤并继续连接。"),
|
||||
("Disable UDP", "禁用 UDP"),
|
||||
("disable-udp-tip", "控制是否仅使用TCP。\n启用此选项后,RustDesk 将不再使用UDP 21116,而是使用TCP 21116。"),
|
||||
("oss-not-support-tip", "注意:RustDesk 开源服务器(oss server) 不包含此功能。"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Hinweis bearbeiten"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", "Scrollen am Rand"),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -258,5 +258,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("websocket_tip", "When using WebSocket, only relay connections are supported."),
|
||||
("terminal-admin-login-tip", "Please input the administrator username and password of the controlled side."),
|
||||
("elevation_username_tip", "Input username or domain\\username"),
|
||||
("allow-insecure-tls-fallback-tip", "By default, RustDesk verifies the server certificate for protocols using TLS.\nWith this option enabled, RustDesk will fall back to skipping the verification step and proceed in case of verification failure."),
|
||||
("disable-udp-tip", "Controls whether to use TCP only.\nWhen this option enabled, RustDesk will not use UDP 21116 any more, TCP 21116 will be used instead."),
|
||||
("oss-not-support-tip", "NOTE: RustDesk server oss doesn't include this feature."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Editar nota"),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -496,12 +496,12 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("resolution_custom_tip", "Käytä mukautettua resoluutiota"),
|
||||
("Collapse toolbar", "Tiivistä työkalupalkki"),
|
||||
("Accept and Elevate", "Hyväksy ja korota oikeudet"),
|
||||
("accept_and_elevate_btn_tooltip", "Hyväksy ja korota oikeudet järjestelmänvalvojaksi"),
|
||||
("clipboard_wait_response_timeout_tip", "Leikepöydän pyyntö aikakatkaistiin – ei vastausta etäpäästä."),
|
||||
("Incoming connection", "Saapuva yhteys"),
|
||||
("Outgoing connection", "Lähtevä yhteys"),
|
||||
("Exit", "Poistu"),
|
||||
("Open", "Avaa"),
|
||||
("accept_and_elevate_btn_tooltip", "Hyväksy ja korota oikeudet järjestelmänvalvojaksi"),
|
||||
("clipboard_wait_response_timeout_tip", "Leikepöydän pyyntö aikakatkaistiin – ei vastausta etäpäästä."),
|
||||
("Incoming connection", "Saapuva yhteys"),
|
||||
("Outgoing connection", "Lähtevä yhteys"),
|
||||
("Exit", "Poistu"),
|
||||
("Open", "Avaa"),
|
||||
("logout_tip", "Haluatko varmasti kirjautua ulos?"),
|
||||
("Service", "Palvelu"),
|
||||
("Start", "Käynnistä"),
|
||||
@@ -721,5 +721,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Show virtual joystick", "Näytä virtuaalinen ohjain"),
|
||||
("Edit note", "Muokkaa muistiinpanoa"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Modifier la note"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Jegyzet szerkesztése"),
|
||||
("Alias", "Álnév"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Modifica nota"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", "Bordo scorrimento"),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "メモを編集"),
|
||||
("Alias", "エイリアス"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "노트 편집"),
|
||||
("Alias", "별명"),
|
||||
("ScrollEdge", "가장자리 스크롤"),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Opmerking bewerken"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Edytuj notatkę"),
|
||||
("Alias", "Alias"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "Изменить заметку"),
|
||||
("Alias", "Псевдоним"),
|
||||
("ScrollEdge", "Прокрутка по краю"),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", "編輯備註"),
|
||||
("Alias", "別名"),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
@@ -722,5 +722,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Edit note", ""),
|
||||
("Alias", ""),
|
||||
("ScrollEdge", ""),
|
||||
("Allow insecure TLS fallback", ""),
|
||||
("allow-insecure-tls-fallback-tip", ""),
|
||||
("Disable UDP", ""),
|
||||
("disable-udp-tip", ""),
|
||||
("oss-not-support-tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
||||
15
src/ui.rs
15
src/ui.rs
@@ -284,6 +284,18 @@ impl UI {
|
||||
crate::using_public_server()
|
||||
}
|
||||
|
||||
fn is_incoming_only(&self) -> bool {
|
||||
hbb_common::config::is_incoming_only()
|
||||
}
|
||||
|
||||
pub fn is_outgoing_only(&self) -> bool {
|
||||
hbb_common::config::is_outgoing_only()
|
||||
}
|
||||
|
||||
pub fn is_custom_client(&self) -> bool {
|
||||
crate::common::is_custom_client()
|
||||
}
|
||||
|
||||
fn get_options(&self) -> Value {
|
||||
let hashmap: HashMap<String, String> =
|
||||
serde_json::from_str(&get_options()).unwrap_or_default();
|
||||
@@ -671,6 +683,9 @@ impl sciter::EventHandler for UI {
|
||||
fn get_api_server();
|
||||
fn is_xfce();
|
||||
fn using_public_server();
|
||||
fn is_custom_client();
|
||||
fn is_outgoing_only();
|
||||
fn is_incoming_only();
|
||||
fn get_id();
|
||||
fn temporary_password();
|
||||
fn update_temporary_password();
|
||||
|
||||
@@ -9,7 +9,9 @@ var app;
|
||||
var tmp = handler.get_connect_status();
|
||||
var connect_status = tmp[0];
|
||||
var service_stopped = handler.get_option("stop-service") == "Y";
|
||||
var disable_udp = handler.get_option("disable-udp") == "Y";
|
||||
var using_public_server = handler.using_public_server();
|
||||
var outgoing_only = handler.is_outgoing_only();
|
||||
var software_update_url = "";
|
||||
var key_confirmed = tmp[1];
|
||||
var system_error = "";
|
||||
@@ -326,8 +328,10 @@ class MyIdMenu: Reactor.Component {
|
||||
<div .separator />
|
||||
<li #custom-server>{translate('ID/Relay Server')}</li>
|
||||
<li #whitelist title={translate('whitelist_tip')}>{translate('IP Whitelisting')}</li>
|
||||
<li #socks5-server>{translate('Socks5 Proxy')}</li>
|
||||
{ false && <li #allow-websocket><span>{svg_checkmark}</span>{translate('Use WebSocket')}</li> }
|
||||
<li #socks5-server>{translate('Socks5/Http(s) Proxy')}</li>
|
||||
<li #allow-websocket><span>{svg_checkmark}</span>{translate('Use WebSocket')}</li>
|
||||
{!using_public_server && !outgoing_only && <li #disable-udp class={disable_udp ? "selected" : "line-through"}><span>{svg_checkmark}</span>{translate('Disable UDP')}</li>}
|
||||
{!using_public_server && <li #allow-insecure-tls-fallback><span>{svg_checkmark}</span>{translate('Allow insecure TLS fallback')}</li>}
|
||||
<div .separator />
|
||||
<li #stop-service class={service_stopped ? "line-through" : "selected"}><span>{svg_checkmark}</span>{translate("Enable service")}</li>
|
||||
{is_win && handler.is_installed() ? <ShareRdp /> : ""}
|
||||
@@ -473,7 +477,7 @@ class MyIdMenu: Reactor.Component {
|
||||
var old_proxy = socks5[0] || "";
|
||||
var old_username = socks5[1] || "";
|
||||
var old_password = socks5[2] || "";
|
||||
msgbox("custom-server", "Socks5 Proxy", <div .form .set-password>
|
||||
msgbox("custom-server", "Socks5/Http(s) Proxy", <div .form .set-password>
|
||||
<div><span>{translate("Server")}:</span><input|text .outline-focus name='proxy' value={old_proxy} /></div>
|
||||
<div><span>{translate("Username")}:</span><input|text name='username' value={old_username} /></div>
|
||||
<div><span>{translate("Password")}:</span><PasswordComponent value={old_password} /></div>
|
||||
@@ -485,11 +489,18 @@ class MyIdMenu: Reactor.Component {
|
||||
var password = (res.password || "").trim();
|
||||
if (proxy == old_proxy && username == old_username && password == old_password) return;
|
||||
if (proxy) {
|
||||
var err = handler.test_if_valid_server(proxy, false);
|
||||
var domain_port = proxy;
|
||||
var protocol_index = domain_port.indexOf('://');
|
||||
if (protocol_index !== -1) {
|
||||
domain_port = domain_port.substring(protocol_index + 3);
|
||||
}
|
||||
var err = handler.test_if_valid_server(domain_port, false);
|
||||
if (err) return translate("Server") + ": " + err;
|
||||
}
|
||||
handler.set_socks(proxy, username, password);
|
||||
}, 240);
|
||||
} else if (me.id == "disable-udp") {
|
||||
handler.set_option("disable-udp", handler.get_option("disable-udp") == "Y" ? "N" : "Y");
|
||||
} else if (me.id == "stop-service") {
|
||||
handler.set_option("stop-service", service_stopped ? "" : "Y");
|
||||
} else if (me.id == "change-id") {
|
||||
@@ -1196,6 +1207,11 @@ function checkConnectStatus() {
|
||||
updateAbPeer();
|
||||
app.update();
|
||||
}
|
||||
tmp = handler.get_option("disable-udp") == "Y";
|
||||
if (tmp != disable_udp) {
|
||||
disable_udp = tmp;
|
||||
app.update();
|
||||
}
|
||||
check_if_overlay();
|
||||
checkConnectStatus();
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{common::do_check_software_update, hbbs_http::create_http_client};
|
||||
use crate::{common::do_check_software_update, hbbs_http::create_http_client_with_url};
|
||||
use hbb_common::{bail, config, log, ResultType};
|
||||
use std::{
|
||||
io::Write,
|
||||
@@ -146,7 +146,7 @@ fn check_update(manually: bool) -> ResultType<()> {
|
||||
format!("{}/rustdesk-{}-x86-sciter.exe", download_url, version)
|
||||
};
|
||||
log::debug!("New version available: {}", &version);
|
||||
let client = create_http_client();
|
||||
let client = create_http_client_with_url(&download_url);
|
||||
let Some(file_path) = get_download_file_from_url(&download_url) else {
|
||||
bail!("Failed to get the file path from the URL: {}", download_url);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user