Make onion_proxy_url override proxy_url setting if request target is onion

This commit is contained in:
silverpill 2023-04-22 15:27:49 +00:00 committed by Rafael Caricio
parent b77d4a9bdf
commit b3b62a9c7f
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947
2 changed files with 3 additions and 2 deletions

View file

@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed ### Fixed
- Make `/api/v1/accounts/{account_id}/follow` work with form-data. - Make `/api/v1/accounts/{account_id}/follow` work with form-data.
- Make `onion_proxy_url` override `proxy_url` setting if request target is onion.
## [1.21.0] - 2023-04-12 ## [1.21.0] - 2023-04-12

View file

@ -15,8 +15,8 @@ pub fn build_federation_client(
let mut client_builder = Client::builder(); let mut client_builder = Client::builder();
let mut maybe_proxy_url = instance.proxy_url.as_ref(); let mut maybe_proxy_url = instance.proxy_url.as_ref();
if is_onion { if is_onion {
maybe_proxy_url = maybe_proxy_url maybe_proxy_url = instance.onion_proxy_url.as_ref()
.or(instance.onion_proxy_url.as_ref()); .or(maybe_proxy_url);
}; };
if let Some(proxy_url) = maybe_proxy_url { if let Some(proxy_url) = maybe_proxy_url {
let proxy = Proxy::all(proxy_url)?; let proxy = Proxy::all(proxy_url)?;