http/https proxy (#7600)

* add http(s) proxy

* Add front-end translation

* fix ui description

* For linux platform, add rustls support

* fix: Fix the proxy address test function.

* add: Added default prompts for agency agreement and some multi-language translations

* add: Http proxy request client

* fix: add async http proxy func and format the code

* add: Preliminary support for flutter front-end calling rust back-end http request

* Optimize HTTP calls

* Optimize HTTP calls

* fix: Optimize HTTP requests, refine translations, and fix dependencies
This commit is contained in:
yuluo
2024-04-23 15:00:23 +08:00
committed by GitHub
parent f11c332cb4
commit da57fcb641
68 changed files with 1231 additions and 133 deletions

View File

@@ -1,4 +1,5 @@
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,
@@ -280,7 +281,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 = reqwest::blocking::Client::new();
let client = create_http_client();
let req = PluginSignReq {
plugin_id: id.clone(),
version: signature_data.version,

View File

@@ -3,6 +3,7 @@
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;
@@ -67,7 +68,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 reqwest::blocking::get(&url) {
match create_http_client().get(&url).send() {
Ok(resp) => {
if !resp.status().is_success() {
log::error!(
@@ -441,6 +442,7 @@ 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},
@@ -469,7 +471,7 @@ pub(super) mod install {
}
fn download_to_file(url: &str, file: File) -> ResultType<()> {
let resp = match reqwest::blocking::get(url) {
let resp = match create_http_client().get(url).send() {
Ok(resp) => resp,
Err(e) => {
bail!("get plugin from '{}', {}", url, e);