mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-28 03:30:33 -05:00
feat(gui): Tor toggle (#300)
* re-add tor info box, show switch for toggling tor * add use_tor to TauriSettings, only initialize tor client when it's true * add warning log message when not using tor client * change the label text of the switch, fail to align switch with SettingsBox icons * move Tor settings to SettingsBox
This commit is contained in:
parent
ffe103cb49
commit
3fa31ba139
9 changed files with 44 additions and 77 deletions
|
|
@ -394,6 +394,12 @@ impl ContextBuilder {
|
|||
};
|
||||
|
||||
let initialize_tor_client = async {
|
||||
// Don't init a tor client unless we should use it.
|
||||
if !self.tor {
|
||||
tracing::warn!("Internal Tor client not enabled, skipping initialization");
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
self.tauri_handle.emit_context_init_progress_event(
|
||||
TauriContextStatusEvent::Initializing(vec![
|
||||
TauriPartialInitProgress::EstablishingTorCircuits(
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ impl TauriHandle {
|
|||
let request_id = Uuid::new_v4();
|
||||
let now_secs = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.expect("it is later than the begin of the unix epoch")
|
||||
.as_secs();
|
||||
let expiration_ts = now_secs + timeout_secs;
|
||||
|
||||
|
|
@ -501,4 +501,6 @@ pub struct TauriSettings {
|
|||
/// The URL of the Electrum RPC server e.g `ssl://bitcoin.com:50001`
|
||||
#[typeshare(serialized_as = "string")]
|
||||
pub electrum_rpc_url: Option<Url>,
|
||||
/// Whether to initialize and use a tor client.
|
||||
pub use_tor: bool,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ async fn next_state(
|
|||
let btc_lock_amount = bitcoin::Amount::from_sat(
|
||||
signed_tx
|
||||
.output
|
||||
.get(0)
|
||||
.first()
|
||||
.context("Failed to get lock amount")?
|
||||
.value,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue