mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-20 19:51:04 +03:00
This reverts commit da57fcb641.
This commit is contained in:
@@ -31,7 +31,7 @@ use hbb_common::tokio::sync::mpsc::UnboundedSender;
|
||||
use hbb_common::tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
anyhow::Context,
|
||||
anyhow::{anyhow, Context},
|
||||
bail,
|
||||
config::{
|
||||
self, Config, LocalConfig, PeerConfig, PeerInfoSerde, Resolution, CONNECT_TIMEOUT,
|
||||
|
||||
@@ -5,8 +5,6 @@ use std::{
|
||||
task::Poll,
|
||||
};
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum GrabState {
|
||||
Ready,
|
||||
@@ -125,7 +123,7 @@ use hbb_common::compress::decompress;
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
anyhow::{anyhow, Context},
|
||||
bail, base64,
|
||||
bail,
|
||||
bytes::Bytes,
|
||||
compress::compress as compress_func,
|
||||
config::{self, Config, CONNECT_TIMEOUT, READ_TIMEOUT},
|
||||
@@ -147,10 +145,7 @@ use hbb_common::{
|
||||
// #[cfg(any(target_os = "android", target_os = "ios", feature = "cli"))]
|
||||
use hbb_common::{config::RENDEZVOUS_PORT, futures::future::join_all};
|
||||
|
||||
use crate::{
|
||||
hbbs_http::create_http_client_async,
|
||||
ui_interface::{get_option, set_option},
|
||||
};
|
||||
use crate::ui_interface::{get_option, set_option};
|
||||
|
||||
pub type NotifyMessageBox = fn(String, String, String, String) -> dyn Future<Output = ()>;
|
||||
|
||||
@@ -977,7 +972,7 @@ pub fn check_software_update() {
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn check_software_update_() -> hbb_common::ResultType<()> {
|
||||
let url = "https://github.com/rustdesk/rustdesk/releases/latest";
|
||||
let latest_release_response = create_http_client_async().get(url).send().await?;
|
||||
let latest_release_response = reqwest::get(url).await?;
|
||||
let latest_release_version = latest_release_response
|
||||
.url()
|
||||
.path()
|
||||
@@ -1072,7 +1067,7 @@ 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 mut req = reqwest::Client::new().post(url);
|
||||
if !header.is_empty() {
|
||||
let tmp: Vec<&str> = header.split(": ").collect();
|
||||
if tmp.len() == 2 {
|
||||
@@ -1089,65 +1084,6 @@ 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,
|
||||
body: Option<String>,
|
||||
header: String,
|
||||
) -> ResultType<String> {
|
||||
let http_client = create_http_client_async();
|
||||
let mut http_client = match method.as_str() {
|
||||
"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())?;
|
||||
|
||||
if let Value::Object(obj) = v {
|
||||
for (key, value) in obj.iter() {
|
||||
http_client = http_client.header(key, value.as_str().unwrap_or_default());
|
||||
}
|
||||
} else {
|
||||
return Err(anyhow!("HTTP header information parsing failed!"));
|
||||
}
|
||||
|
||||
if let Some(b) = body {
|
||||
http_client = http_client.body(b);
|
||||
}
|
||||
|
||||
let response = http_client
|
||||
.timeout(std::time::Duration::from_secs(12))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
// Serialize response headers
|
||||
let mut response_headers = serde_json::map::Map::new();
|
||||
for (key, value) in response.headers() {
|
||||
response_headers.insert(
|
||||
key.to_string(),
|
||||
serde_json::json!(value.to_str().unwrap_or("")),
|
||||
);
|
||||
}
|
||||
|
||||
let status_code = response.status().as_u16();
|
||||
let response_body = response.text().await?;
|
||||
|
||||
// Construct the JSON object
|
||||
let mut result = serde_json::map::Map::new();
|
||||
result.insert("status_code".to_string(), serde_json::json!(status_code));
|
||||
result.insert(
|
||||
"headers".to_string(),
|
||||
serde_json::Value::Object(response_headers),
|
||||
);
|
||||
result.insert("body".to_string(), serde_json::json!(response_body));
|
||||
|
||||
// Convert map to JSON string
|
||||
serde_json::to_string(&result).map_err(|e| anyhow!("Failed to serialize response: {}", e))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn make_privacy_mode_msg_with_details(
|
||||
state: back_notification::PrivacyModeState,
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use hbb_common::{
|
||||
bail,
|
||||
base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _},
|
||||
sodiumoxide::crypto::sign,
|
||||
ResultType,
|
||||
};
|
||||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
|
||||
use hbb_common::{bail, sodiumoxide::crypto::sign, ResultType};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, PartialEq, Default, Serialize, Deserialize, Clone)]
|
||||
|
||||
@@ -749,10 +749,6 @@ pub fn main_get_async_status() -> String {
|
||||
get_async_job_status()
|
||||
}
|
||||
|
||||
pub fn main_get_http_status(url: String) -> Option<String> {
|
||||
get_async_http_status(url)
|
||||
}
|
||||
|
||||
pub fn main_get_option(key: String) -> String {
|
||||
get_option(key)
|
||||
}
|
||||
@@ -809,10 +805,6 @@ pub fn main_set_socks(proxy: String, username: String, password: String) {
|
||||
set_socks(proxy, username, password)
|
||||
}
|
||||
|
||||
pub fn main_get_proxy_status() -> bool {
|
||||
get_proxy_status()
|
||||
}
|
||||
|
||||
pub fn main_get_socks() -> Vec<String> {
|
||||
get_socks()
|
||||
}
|
||||
@@ -886,8 +878,9 @@ pub fn main_get_api_server() -> String {
|
||||
get_api_server()
|
||||
}
|
||||
|
||||
pub fn main_http_request(url: String, method: String, body: Option<String>, header: String) {
|
||||
http_request(url,method, body, header)
|
||||
// This function doesn't seem to be used.
|
||||
pub fn main_post_request(url: String, body: String, header: String) {
|
||||
post_request(url, body, header)
|
||||
}
|
||||
|
||||
pub fn main_get_local_option(key: String) -> SyncReturn<String> {
|
||||
|
||||
@@ -4,11 +4,8 @@ use serde_json::{Map, Value};
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
pub mod account;
|
||||
mod http_client;
|
||||
pub mod record_upload;
|
||||
pub mod sync;
|
||||
pub use http_client::create_http_client;
|
||||
pub use http_client::create_http_client_async;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum HbbHttpResponse<T> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::HbbHttpResponse;
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use hbb_common::{config::LocalConfig, log, ResultType};
|
||||
use reqwest::blocking::Client;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@@ -131,7 +130,7 @@ impl Default for UserStatus {
|
||||
impl OidcSession {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
client: create_http_client(),
|
||||
client: Client::new(),
|
||||
state_msg: REQUESTING_ACCOUNT_AUTH,
|
||||
failed_msg: "".to_owned(),
|
||||
code_url: None,
|
||||
@@ -169,7 +168,7 @@ impl OidcSession {
|
||||
id: &str,
|
||||
uuid: &str,
|
||||
) -> ResultType<HbbHttpResponse<AuthBody>> {
|
||||
let url = Url::parse_with_params(
|
||||
let url = reqwest::Url::parse_with_params(
|
||||
&format!("{}/api/oidc/auth-query", api_server),
|
||||
&[("code", code), ("id", id), ("uuid", uuid)],
|
||||
)?;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
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;
|
||||
|
||||
macro_rules! configure_http_client {
|
||||
($builder:expr, $Client: ty) => {{
|
||||
let mut builder = $builder;
|
||||
let client = if let Some(conf) = Config::get_socks() {
|
||||
let proxy_result = Proxy::from_conf(&conf, None);
|
||||
|
||||
match proxy_result {
|
||||
Ok(proxy) => {
|
||||
let proxy_setup = match &proxy.intercept {
|
||||
ProxyScheme::Http { host, .. } =>{ reqwest::Proxy::http(format!("http://{}", host))},
|
||||
ProxyScheme::Https { host, .. } => {reqwest::Proxy::https(format!("https://{}", host))},
|
||||
ProxyScheme::Socks5 { addr, .. } => { reqwest::Proxy::all(&format!("socks5://{}", addr)) }
|
||||
};
|
||||
|
||||
match proxy_setup {
|
||||
Ok(p) => {
|
||||
builder = builder.proxy(p);
|
||||
if let Some(auth) = proxy.intercept.maybe_auth() {
|
||||
let basic_auth =
|
||||
format!("Basic {}", auth.get_basic_authorization());
|
||||
builder = builder.default_headers(
|
||||
vec![(
|
||||
reqwest::header::PROXY_AUTHORIZATION,
|
||||
basic_auth.parse().unwrap(),
|
||||
)]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
builder.build().unwrap_or_else(|e| {
|
||||
info!("Failed to create a proxied client: {}", e);
|
||||
<$Client>::new()
|
||||
})
|
||||
}
|
||||
Err(e) => {
|
||||
info!("Failed to set up proxy: {}", e);
|
||||
<$Client>::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
info!("Failed to configure proxy: {}", e);
|
||||
<$Client>::new()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
builder.build().unwrap_or_else(|e| {
|
||||
info!("Failed to create a client: {}", e);
|
||||
<$Client>::new()
|
||||
})
|
||||
};
|
||||
|
||||
client
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn create_http_client() -> SyncClient {
|
||||
let builder = SyncClient::builder();
|
||||
configure_http_client!(builder, SyncClient)
|
||||
}
|
||||
|
||||
pub fn create_http_client_async() -> AsyncClient {
|
||||
let builder = AsyncClient::builder();
|
||||
configure_http_client!(builder, AsyncClient)
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use bytes::Bytes;
|
||||
use hbb_common::{bail, config::Config, lazy_static, log, ResultType};
|
||||
use reqwest::blocking::{Body, Client};
|
||||
@@ -26,7 +25,7 @@ pub fn is_enable() -> bool {
|
||||
|
||||
pub fn run(rx: Receiver<RecordState>) {
|
||||
let mut uploader = RecordUploader {
|
||||
client: create_http_client(),
|
||||
client: Client::new(),
|
||||
api_server: crate::get_api_server(
|
||||
Config::get_option("api-server"),
|
||||
Config::get_option("custom-rendezvous-server"),
|
||||
|
||||
@@ -904,9 +904,6 @@ pub async fn set_socks(value: config::Socks5Server) -> ResultType<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_proxy_status() -> bool {
|
||||
Config::get_socks().is_some()
|
||||
}
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn test_rendezvous_server() -> ResultType<()> {
|
||||
let mut c = connect(1000, "").await?;
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "فارغ"),
|
||||
("Invalid folder name", "اسم المجلد غير صحيح"),
|
||||
("Socks5 Proxy", "وكيل Socks5"),
|
||||
("Socks5/Http(s) Proxy", "وكيل Socks5/Http(s)"),
|
||||
("Discovered", "المكتشفة"),
|
||||
("install_daemon_tip", "للبدء مع بدء تشغيل النظام. تحتاج الى تثبيت خدمة النظام."),
|
||||
("Remote ID", "المعرف البعيد"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", ""),
|
||||
("Invalid folder name", ""),
|
||||
("Socks5 Proxy", "Socks5 прокси"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) прокси"),
|
||||
("Discovered", ""),
|
||||
("install_daemon_tip", "За стартиране с компютъра трябва да инсталирате системна услуга."),
|
||||
("Remote ID", ""),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Buit"),
|
||||
("Invalid folder name", "Nom de carpeta incorrecte"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Descobert"),
|
||||
("install_daemon_tip", ""),
|
||||
("Remote ID", "ID remot"),
|
||||
|
||||
@@ -239,8 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "空空如也"),
|
||||
("Invalid folder name", "无效文件夹名称"),
|
||||
("Socks5 Proxy", "Socks5 代理"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) 代理"),
|
||||
("Default protocol and port are Socks5 and 1080", "默认代理协议及端口为Socks5和1080"),
|
||||
("Discovered", "已发现"),
|
||||
("install_daemon_tip", "为了开机启动,请安装系统服务。"),
|
||||
("Remote ID", "远程 ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Prázdné"),
|
||||
("Invalid folder name", "Neplatný název složky"),
|
||||
("Socks5 Proxy", "Socks5 proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) proxy"),
|
||||
("Discovered", "Objeveno"),
|
||||
("install_daemon_tip", "Pokud má být spouštěno při startu systému, je třeba nainstalovat systémovou službu."),
|
||||
("Remote ID", "Vzdálené ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Tom"),
|
||||
("Invalid folder name", "Ugyldigt mappenavn"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Fundet"),
|
||||
("install_daemon_tip", "For at starte efter PC'en er startet op, skal du installere systemtjenesten"),
|
||||
("Remote ID", "Fjern-ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Keine Einträge"),
|
||||
("Invalid folder name", "Ungültiger Ordnername"),
|
||||
("Socks5 Proxy", "SOCKS5-Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s)-Proxy"),
|
||||
("Discovered", "Im LAN erkannt"),
|
||||
("install_daemon_tip", "Um mit System zu starten, muss der Systemdienst installiert sein."),
|
||||
("Remote ID", "Entfernte ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Άδειο"),
|
||||
("Invalid folder name", "Μη έγκυρο όνομα φακέλου"),
|
||||
("Socks5 Proxy", "Διαμεσολαβητής Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Διαμεσολαβητής Socks5/Http(s)"),
|
||||
("Discovered", "Ανακαλύφθηκαν"),
|
||||
("install_daemon_tip", "Για να ξεκινά με την εκκίνηση του υπολογιστή, πρέπει να εγκαταστήσετε την υπηρεσία συστήματος"),
|
||||
("Remote ID", "Απομακρυσμένο ID"),
|
||||
|
||||
@@ -60,8 +60,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Add to Favorites", "Add to favorites"),
|
||||
("Remove from Favorites", "Remove from favorites"),
|
||||
("Socks5 Proxy", "Socks5 proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) proxy"),
|
||||
("Default protocol and port are Socks5 and 1080", "Default protocol and port are Socks5 and 1080"),
|
||||
("install_daemon_tip", "For starting on boot, you need to install system service."),
|
||||
("Are you sure to close the connection?", "Are you sure you want to close the connection?"),
|
||||
("One-Finger Tap", "One-finger tap"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Malplena"),
|
||||
("Invalid folder name", "Dosiernomo nevalida"),
|
||||
("Socks5 Proxy", "Socks5 prokura servilo"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) prokura servilo"),
|
||||
("Discovered", "Malkovritaj"),
|
||||
("install_daemon_tip", ""),
|
||||
("Remote ID", "Fora identigilo"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Vacío"),
|
||||
("Invalid folder name", "Nombre de carpeta incorrecto"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Descubierto"),
|
||||
("install_daemon_tip", "Para comenzar en el encendido, debe instalar el servicio del sistema."),
|
||||
("Remote ID", "ID remoto"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", ""),
|
||||
("Invalid folder name", ""),
|
||||
("Socks5 Proxy", "Socks5 proksi"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) proksi"),
|
||||
("Discovered", ""),
|
||||
("install_daemon_tip", "Süsteemikäivitusel käivitamiseks tuleb paigaldada süsteemiteenus."),
|
||||
("Remote ID", ""),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "موردی وجود ندارد"),
|
||||
("Invalid folder name", "نام پوشه نامعتبر است"),
|
||||
("Socks5 Proxy", "Socks5 پروکسی"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) پروکسی"),
|
||||
("Discovered", "پیدا شده"),
|
||||
("install_daemon_tip", "برای شروع در هنگام راه اندازی، باید سرویس سیستم را نصب کنید"),
|
||||
("Remote ID", "شناسه راه دور"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Vide"),
|
||||
("Invalid folder name", "Nom de dossier invalide"),
|
||||
("Socks5 Proxy", "Socks5 Agents"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Agents"),
|
||||
("Discovered", "Découvert"),
|
||||
("install_daemon_tip", "Pour une exécution au démarrage du système, vous devez installer le service système."),
|
||||
("Remote ID", "ID de l'appareil distant"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", ""),
|
||||
("Invalid folder name", ""),
|
||||
("Socks5 Proxy", "פרוקסי Socks5"),
|
||||
("Socks5/Http(s) Proxy", "פרוקסי Socks5/Http(s)"),
|
||||
("Discovered", ""),
|
||||
("install_daemon_tip", "לצורך הפעלה בעת הפעלת המחשב, עליך להתקין שירות מערכת."),
|
||||
("Remote ID", ""),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Üres"),
|
||||
("Invalid folder name", "Helytelen mappa név"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Felfedezett"),
|
||||
("install_daemon_tip", "Az automatikus indításhoz szükséges a szolgáltatás telepítése"),
|
||||
("Remote ID", "Távoli azonosító"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Kosong"),
|
||||
("Invalid folder name", "Nama folder tidak valid"),
|
||||
("Socks5 Proxy", "Proksi Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proksi Socks5/Http(s)"),
|
||||
("Discovered", "Telah ditemukan"),
|
||||
("install_daemon_tip", "Untuk memulai saat boot, Anda perlu menginstal system service."),
|
||||
("Remote ID", "ID Remote"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Vuoto"),
|
||||
("Invalid folder name", "Nome della cartella non valido"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Rilevate"),
|
||||
("install_daemon_tip", "Per avviare il programma all'accensione, è necessario installarlo come servizio di sistema."),
|
||||
("Remote ID", "ID remoto"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "空"),
|
||||
("Invalid folder name", "無効なフォルダ名"),
|
||||
("Socks5 Proxy", "SOCKS5プロキシ"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s)プロキシ"),
|
||||
("Discovered", "探知済み"),
|
||||
("install_daemon_tip", "起動時に開始するには、システムサービスをインストールする必要があります。"),
|
||||
("Remote ID", "リモートのID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "비어 있음"),
|
||||
("Invalid folder name", "유효하지 않은 폴더명"),
|
||||
("Socks5 Proxy", "Socks5 프록시"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) 프록시"),
|
||||
("Discovered", "찾음"),
|
||||
("install_daemon_tip", "부팅된 이후 시스템 서비스에 설치해야 합니다."),
|
||||
("Remote ID", "원격 ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Бос"),
|
||||
("Invalid folder name", "Бұрыс бума атауы"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Табылды"),
|
||||
("install_daemon_tip", "Бут кезінде қосылу үшін жүйелік сербесті орнатуыныз керек."),
|
||||
("Remote ID", "Қашықтағы ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Tuščia"),
|
||||
("Invalid folder name", "Neteisingas aplanko pavadinimas"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Aptikta tinkle"),
|
||||
("install_daemon_tip", "Norėdami, kad RustDesk startuotų automatiškai, turite ją įdiegti"),
|
||||
("Remote ID", "Nuotolinis ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Tukšs"),
|
||||
("Invalid folder name", "Nederīgs mapes nosaukums"),
|
||||
("Socks5 Proxy", "Socks5 starpniekserveris"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) starpniekserveris"),
|
||||
("Discovered", "Atklāts"),
|
||||
("install_daemon_tip", "Lai palaistu pie startēšanas, ir jāinstalē sistēmas serviss."),
|
||||
("Remote ID", "Attālais ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Tom"),
|
||||
("Invalid folder name", "Ugyldig mappenavn"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Oppdaget"),
|
||||
("install_daemon_tip", "For å starte når PC'en har startet opp, må du installere systemtjenesten"),
|
||||
("Remote ID", "Fjern-ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Leeg"),
|
||||
("Invalid folder name", "Ongeldige mapnaam"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Ontdekt"),
|
||||
("install_daemon_tip", "Om bij het opstarten van de computer te kunnen beginnen, moet u de systeemservice installeren."),
|
||||
("Remote ID", "Externe ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Pusto"),
|
||||
("Invalid folder name", "Nieprawidłowa nazwa folderu"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Wykryte"),
|
||||
("install_daemon_tip", "By uruchomić RustDesk przy starcie systemu, musisz zainstalować usługę systemową."),
|
||||
("Remote ID", "Zdalne ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Vazio"),
|
||||
("Invalid folder name", "Nome de diretório inválido"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Descoberto"),
|
||||
("install_daemon_tip", "Para inicialização junto do sistema, deve instalar o serviço de sistema."),
|
||||
("Remote ID", "ID Remoto"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Vazio"),
|
||||
("Invalid folder name", "Nome de diretório inválido"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Descoberto"),
|
||||
("install_daemon_tip", "Para inicialização junto ao sistema, você deve instalar o serviço de sistema."),
|
||||
("Remote ID", "ID Remoto"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Gol"),
|
||||
("Invalid folder name", "Denumire folder nevalidă"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Descoperite"),
|
||||
("install_daemon_tip", "Pentru executare la pornirea sistemului, instalează serviciul de sistem."),
|
||||
("Remote ID", "ID dispozitiv la distanță"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Пусто"),
|
||||
("Invalid folder name", "Недопустимое имя папки"),
|
||||
("Socks5 Proxy", "SOCKS5-прокси"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s)-прокси"),
|
||||
("Discovered", "Найдено"),
|
||||
("install_daemon_tip", "Для запуска при загрузке необходимо установить системную службу"),
|
||||
("Remote ID", "Удалённый ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Prázdne"),
|
||||
("Invalid folder name", "Neplatný názov adresára"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Objavené"),
|
||||
("install_daemon_tip", "Ak chcete, aby sa spúšťal pri štarte systému, musíte nainštalovať systémovú službu."),
|
||||
("Remote ID", "Vzdialené ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Prazno"),
|
||||
("Invalid folder name", "Napačno ime mape"),
|
||||
("Socks5 Proxy", "Socks5 posredniški strežnik"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) posredniški strežnik"),
|
||||
("Discovered", "Odkriti"),
|
||||
("install_daemon_tip", "Za samodejni zagon ob vklopu računalnika je potrebno dodati sistemsko storitev"),
|
||||
("Remote ID", "Oddaljeni ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Bosh"),
|
||||
("Invalid folder name", "Emri i dosjes i pavlefshëm"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "I pambuluar"),
|
||||
("install_daemon_tip", "Për të nisur në boot, duhet të instaloni shërbimin e sistemit"),
|
||||
("Remote ID", "ID në distancë"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Prazno"),
|
||||
("Invalid folder name", "Pogrešno ime direktorijuma"),
|
||||
("Socks5 Proxy", "Socks5 proksi"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) proksi"),
|
||||
("Discovered", "Otkriveno"),
|
||||
("install_daemon_tip", "Za pokretanje pri startu sistema, treba da instalirate sistemski servis."),
|
||||
("Remote ID", "Udaljeni ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Tom"),
|
||||
("Invalid folder name", "Ogiltigt mappnamn"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Upptäckt"),
|
||||
("install_daemon_tip", "För att starta efter boot måste du installera systemtjänsten."),
|
||||
("Remote ID", "Fjärr ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", ""),
|
||||
("Invalid folder name", ""),
|
||||
("Socks5 Proxy", ""),
|
||||
("Socks5/Http(s) Proxy", ""),
|
||||
("Discovered", ""),
|
||||
("install_daemon_tip", ""),
|
||||
("Remote ID", ""),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "ว่างเปล่า"),
|
||||
("Invalid folder name", "ชื่อโฟลเดอร์ไม่ถูกต้อง"),
|
||||
("Socks5 Proxy", "พรอกซี Socks5"),
|
||||
("Socks5/Http(s) Proxy", "พรอกซี Socks5/Http(s)"),
|
||||
("Discovered", "ค้นพบ"),
|
||||
("install_daemon_tip", "หากต้องการใช้งานขณะระบบเริ่มต้น คุณจำเป็นจะต้องติดตั้งเซอร์วิส"),
|
||||
("Remote ID", "ID ปลายทาง"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Boş"),
|
||||
("Invalid folder name", "Geçersiz klasör adı"),
|
||||
("Socks5 Proxy", "Socks5 Proxy"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) Proxy"),
|
||||
("Discovered", "Keşfedilenler"),
|
||||
("install_daemon_tip", "Başlangıçta başlamak için sistem hizmetini yüklemeniz gerekir."),
|
||||
("Remote ID", "Uzak ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "空空如也"),
|
||||
("Invalid folder name", "資料夾名稱無效"),
|
||||
("Socks5 Proxy", "Socks5 代理伺服器"),
|
||||
("Socks5/Http(s) Proxy", "Socks5/Http(s) 代理伺服器"),
|
||||
("Discovered", "已探索"),
|
||||
("install_daemon_tip", "若要在開機時啟動,您需要安裝系統服務。"),
|
||||
("Remote ID", "遠端 ID"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Пусто"),
|
||||
("Invalid folder name", "Неприпустима назва теки"),
|
||||
("Socks5 Proxy", "Проксі-сервер Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Проксі-сервер Socks5/Http(s)"),
|
||||
("Discovered", "Знайдено"),
|
||||
("install_daemon_tip", "Для запуску під час завантаження, вам необхідно встановити системну службу"),
|
||||
("Remote ID", "Віддалений ідентифікатор"),
|
||||
|
||||
@@ -239,7 +239,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Empty", "Trống"),
|
||||
("Invalid folder name", "Tên thư mục không hợp lệ"),
|
||||
("Socks5 Proxy", "Proxy Socks5"),
|
||||
("Socks5/Http(s) Proxy", "Proxy Socks5/Http(s)"),
|
||||
("Discovered", "Đuợc phát hiện"),
|
||||
("install_daemon_tip", "Để chạy lúc khởi động máy, bạn cần phải cài dịch vụ hệ thống."),
|
||||
("Remote ID", "ID từ xa"),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
mod custom_server;
|
||||
use hbb_common::{ResultType, base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _}};
|
||||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
|
||||
use hbb_common::ResultType;
|
||||
use custom_server::*;
|
||||
|
||||
fn gen_name(lic: &CustomServer) -> ResultType<String> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use crate::{
|
||||
flutter::{self, APP_TYPE_CM, APP_TYPE_MAIN, SESSIONS},
|
||||
ui_interface::get_api_server,
|
||||
@@ -281,7 +280,7 @@ fn request_plugin_sign(id: String, msg_to_rustdesk: MsgToRustDesk) -> PluginRetu
|
||||
);
|
||||
thread::spawn(move || {
|
||||
let sign_url = format!("{}/lic/web/api/plugin-sign", get_api_server());
|
||||
let client = create_http_client();
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let req = PluginSignReq {
|
||||
plugin_id: id.clone(),
|
||||
version: signature_data.version,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
use super::{desc::Meta as PluginMeta, ipc::InstallStatus, *};
|
||||
use crate::flutter;
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use hbb_common::{allow_err, bail, log, tokio, toml};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
@@ -68,7 +67,7 @@ fn get_source_plugins() -> HashMap<String, PluginInfo> {
|
||||
let mut plugins = HashMap::new();
|
||||
for source in get_plugin_source_list().into_iter() {
|
||||
let url = format!("{}/meta.toml", source.url);
|
||||
match create_http_client().get(&url).send() {
|
||||
match reqwest::blocking::get(&url) {
|
||||
Ok(resp) => {
|
||||
if !resp.status().is_success() {
|
||||
log::error!(
|
||||
@@ -442,7 +441,6 @@ fn update_uninstall_id_set(set: HashSet<String>) -> ResultType<()> {
|
||||
// install process
|
||||
pub(super) mod install {
|
||||
use super::IPC_PLUGIN_POSTFIX;
|
||||
use crate::hbbs_http::create_http_client;
|
||||
use crate::{
|
||||
ipc::{connect, Data},
|
||||
plugin::ipc::{InstallStatus, Plugin},
|
||||
@@ -471,7 +469,7 @@ pub(super) mod install {
|
||||
}
|
||||
|
||||
fn download_to_file(url: &str, file: File) -> ResultType<()> {
|
||||
let resp = match create_http_client().get(url).send() {
|
||||
let resp = match reqwest::blocking::get(url) {
|
||||
Ok(resp) => resp,
|
||||
Err(e) => {
|
||||
bail!("get plugin from '{}', {}", url, e);
|
||||
|
||||
@@ -15,7 +15,6 @@ use hbb_common::{
|
||||
config::{self, Config, CONNECT_TIMEOUT, READ_TIMEOUT, REG_INTERVAL, RENDEZVOUS_PORT},
|
||||
futures::future::join_all,
|
||||
log,
|
||||
proxy::Proxy,
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
sleep,
|
||||
@@ -389,14 +388,7 @@ impl RendezvousMediator {
|
||||
|
||||
pub async fn start(server: ServerPtr, host: String) -> ResultType<()> {
|
||||
log::info!("start rendezvous mediator of {}", host);
|
||||
//If the investment agent type is http or https, then tcp forwarding is enabled.
|
||||
let is_http_proxy = if let Some(conf) = Config::get_socks() {
|
||||
let proxy = Proxy::from_conf(&conf, None)?;
|
||||
proxy.is_http_or_https()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some()) || is_http_proxy {
|
||||
if cfg!(debug_assertions) && option_env!("TEST_TCP").is_some() {
|
||||
Self::start_tcp(server, host).await
|
||||
} else {
|
||||
Self::start_udp(server, host).await
|
||||
|
||||
@@ -548,10 +548,6 @@ impl UI {
|
||||
change_id_shared(id, old_id);
|
||||
}
|
||||
|
||||
fn http_request(&self, url: String, method: String, body: Option<String>, header: String) {
|
||||
http_request(url, method, body, header)
|
||||
}
|
||||
|
||||
fn post_request(&self, url: String, body: String, header: String) {
|
||||
post_request(url, body, header)
|
||||
}
|
||||
@@ -564,10 +560,6 @@ impl UI {
|
||||
get_async_job_status()
|
||||
}
|
||||
|
||||
fn get_http_status(&self, url: String) -> Option<String> {
|
||||
get_async_http_status(url)
|
||||
}
|
||||
|
||||
fn t(&self, name: String) -> String {
|
||||
crate::client::translate(name)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use hbb_common::{
|
||||
allow_err,
|
||||
bytes::Bytes,
|
||||
config::{
|
||||
self, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT, RENDEZVOUS_PORT,
|
||||
self, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT, HARD_SETTINGS, RENDEZVOUS_PORT,
|
||||
},
|
||||
directories_next,
|
||||
futures::future::join_all,
|
||||
@@ -65,7 +65,6 @@ lazy_static::lazy_static! {
|
||||
id: "".to_owned(),
|
||||
}));
|
||||
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
||||
static ref ASYNC_HTTP_STATUS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(HashMap::new()));
|
||||
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
||||
}
|
||||
|
||||
@@ -422,16 +421,6 @@ pub fn set_socks(proxy: String, username: String, password: String) {
|
||||
.ok();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_proxy_status() -> bool {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
return ipc::get_proxy_status();
|
||||
|
||||
// Currently, only the desktop version has proxy settings.
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
pub fn set_socks(_: String, _: String, _: String) {}
|
||||
|
||||
@@ -719,28 +708,6 @@ pub fn change_id(id: String) {
|
||||
});
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn http_request(url: String, method: String, body: Option<String>, header: String) {
|
||||
// Respond to concurrent requests for resources
|
||||
let current_request = ASYNC_HTTP_STATUS.clone();
|
||||
current_request.lock().unwrap().insert(url.clone()," ".to_owned());
|
||||
std::thread::spawn(move || {
|
||||
let res = match crate::http_request_sync(url.clone(), method, body, header) {
|
||||
Err(err) => { log::error!("{}", err); err.to_string() },
|
||||
Ok(text) => text,
|
||||
};
|
||||
current_request.lock().unwrap().insert(url,res);
|
||||
});
|
||||
}
|
||||
#[inline]
|
||||
pub fn get_async_http_status(url: String) -> Option<String> {
|
||||
match ASYNC_HTTP_STATUS.lock().unwrap().get(&url) {
|
||||
None => {None}
|
||||
Some(_str) => {Some(_str.to_string())}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn post_request(url: String, body: String, header: String) {
|
||||
*ASYNC_JOB_STATUS.lock().unwrap() = " ".to_owned();
|
||||
|
||||
Reference in New Issue
Block a user