add remote node flag to gui

This commit is contained in:
creating2morrow 2023-06-20 08:39:17 -04:00
parent 7b50e6d666
commit ed91849a27
3 changed files with 16 additions and 0 deletions

View file

@ -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,

View file

@ -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)

View file

@ -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;