From ed91849a270301f25855e617abf78c25202d4185 Mon Sep 17 00:00:00 2001 From: creating2morrow Date: Tue, 20 Jun 2023 08:39:17 -0400 Subject: [PATCH] add remote node flag to gui --- neveko-core/src/args.rs | 7 +++++++ neveko-core/src/utils.rs | 4 ++++ neveko-gui/src/apps/home.rs | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/neveko-core/src/args.rs b/neveko-core/src/args.rs index fe98487..c881fc0 100644 --- a/neveko-core/src/args.rs +++ b/neveko-core/src/args.rs @@ -120,6 +120,13 @@ pub struct Args { default_value = "false" )] pub remote_node: bool, + /// Dummy flag for normal mode when not using remote node + #[arg( + long, + help = "dummy flag for normal node operations. (Future use)", + default_value = "false" + )] + pub full_node: bool, /// Connect to micro servers #[arg( long, diff --git a/neveko-core/src/utils.rs b/neveko-core/src/utils.rs index 90627d1..31b890f 100644 --- a/neveko-core/src/utils.rs +++ b/neveko-core/src/utils.rs @@ -85,6 +85,7 @@ pub struct Connections { pub blockchain_dir: String, pub daemon_host: String, pub i2p_zero_dir: String, + pub is_remote_node: bool, pub mainnet: bool, pub monero_location: String, pub rpc_credential: String, @@ -98,6 +99,7 @@ impl Default for Connections { blockchain_dir: String::from("/home/user/.bitmonero"), daemon_host: String::from("http://localhost:38081"), i2p_zero_dir: String::from("/home/user/i2p-zero-linux.v1.21"), + is_remote_node: false, mainnet: false, monero_location: String::from("/home/user/monero-x86_64-linux-gnu-v0.18.2.2"), rpc_credential: String::from("pass"), @@ -140,6 +142,7 @@ impl ReleaseEnvironment { /// start core module from gui pub fn start_core(conn: &Connections) { let env = if !conn.mainnet { "dev" } else { "prod" }; + let remote_node = if !conn.is_remote_node { "--full-node" } else { "--remote-node" }; let args = [ "--monero-location", &conn.monero_location, @@ -157,6 +160,7 @@ pub fn start_core(conn: &Connections) { &conn.i2p_zero_dir, "-r", env, + remote_node ]; let output = std::process::Command::new("./neveko") .args(args) diff --git a/neveko-gui/src/apps/home.rs b/neveko-gui/src/apps/home.rs index 9b7d2e4..8594546 100644 --- a/neveko-gui/src/apps/home.rs +++ b/neveko-gui/src/apps/home.rs @@ -261,6 +261,11 @@ impl eframe::App for HomeApp { ui.text_edit_singleline(&mut self.connections.i2p_zero_dir) .labelled_by(cm_i2p_dir_label.id); }); + let mut is_remote_node = self.connections.is_remote_node; + if ui.checkbox(&mut is_remote_node, "remote node").changed() { + self.connections.is_remote_node = !self.connections.is_remote_node; + log::debug!("is remote node: {}", self.connections.is_remote_node); + } // let mut is_mainnet = self.connections.mainnet; // if ui.checkbox(&mut is_mainnet, "mainnet").changed() { // self.connections.mainnet = !self.connections.mainnet;