mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
disk: fix serializing quotes in strings
This commit is contained in:
parent
3ac0b98802
commit
166c89a8d1
3 changed files with 28 additions and 9 deletions
31
src/disk.rs
31
src/disk.rs
|
@ -348,15 +348,24 @@ impl Node {
|
|||
let mut vec = Vec::with_capacity(size);
|
||||
for (key, values) in nodes.iter() {
|
||||
let ip = match values.get("ip") {
|
||||
Some(ip) => ip.to_string(),
|
||||
Some(ip) => match ip.as_str() {
|
||||
Some(ip) => ip.to_string(),
|
||||
None => { error!("Node | [None] at [ip] parse"); return Err(TomlError::Parse("[None] at [ip] parse")) },
|
||||
},
|
||||
None => { error!("Node | [None] at [ip] parse"); return Err(TomlError::Parse("[None] at [ip] parse")) },
|
||||
};
|
||||
let rpc = match values.get("rpc") {
|
||||
Some(rpc) => rpc.to_string(),
|
||||
Some(rpc) => match rpc.as_str() {
|
||||
Some(rpc) => rpc.to_string(),
|
||||
None => { error!("Node | [None] at [rpc] parse"); return Err(TomlError::Parse("[None] at [rpc] parse")) },
|
||||
},
|
||||
None => { error!("Node | [None] at [rpc] parse"); return Err(TomlError::Parse("[None] at [rpc] parse")) },
|
||||
};
|
||||
let zmq = match values.get("zmq") {
|
||||
Some(zmq) => zmq.to_string(),
|
||||
Some(zmq) => match zmq.as_str() {
|
||||
Some(zmq) => zmq.to_string(),
|
||||
None => { error!("Node | [None] at [zmq] parse"); return Err(TomlError::Parse("[None] at [zmq] parse")) },
|
||||
},
|
||||
None => { error!("Node | [None] at [zmq] parse"); return Err(TomlError::Parse("[None] at [zmq] parse")) },
|
||||
};
|
||||
let node = Node {
|
||||
|
@ -470,17 +479,27 @@ impl Pool {
|
|||
};
|
||||
let size = pools.keys().len();
|
||||
let mut vec = Vec::with_capacity(size);
|
||||
// We have to do [.as_str()] -> [.to_string()] to get rid of the \"...\" that gets added on.
|
||||
for (key, values) in pools.iter() {
|
||||
let rig = match values.get("rig") {
|
||||
Some(rig) => rig.to_string(),
|
||||
Some(rig) => match rig.as_str() {
|
||||
Some(rig) => rig.to_string(),
|
||||
None => { error!("Pool | [None] at [rig] parse"); return Err(TomlError::Parse("[None] at [rig] parse")) },
|
||||
},
|
||||
None => { error!("Pool | [None] at [rig] parse"); return Err(TomlError::Parse("[None] at [rig] parse")) },
|
||||
};
|
||||
let ip = match values.get("ip") {
|
||||
Some(ip) => ip.to_string(),
|
||||
Some(ip) => match ip.as_str() {
|
||||
Some(ip) => ip.to_string(),
|
||||
None => { error!("Pool | [None] at [ip] parse"); return Err(TomlError::Parse("[None] at [ip] parse")) },
|
||||
},
|
||||
None => { error!("Pool | [None] at [ip] parse"); return Err(TomlError::Parse("[None] at [ip] parse")) },
|
||||
};
|
||||
let port = match values.get("port") {
|
||||
Some(port) => port.to_string(),
|
||||
Some(port) => match port.as_str() {
|
||||
Some(port) => port.to_string(),
|
||||
None => { error!("Pool | [None] at [port] parse"); return Err(TomlError::Parse("[None] at [port] parse")) },
|
||||
},
|
||||
None => { error!("Pool | [None] at [port] parse"); return Err(TomlError::Parse("[None] at [port] parse")) },
|
||||
};
|
||||
let pool = Pool {
|
||||
|
|
|
@ -1308,7 +1308,7 @@ impl eframe::App for App {
|
|||
ui.group(|ui| {
|
||||
ui.set_enabled(self.diff);
|
||||
let width = width / 2.0;
|
||||
if key.is_r() && !wants_input || ui.add_sized([width, height], Button::new("Reset")).on_hover_text("Reset changes").clicked() {
|
||||
if key.is_r() && !wants_input && self.diff || ui.add_sized([width, height], Button::new("Reset")).on_hover_text("Reset changes").clicked() {
|
||||
let og = self.og.lock().unwrap().clone();
|
||||
self.state.gupax = og.gupax;
|
||||
self.state.p2pool = og.p2pool;
|
||||
|
@ -1316,7 +1316,7 @@ impl eframe::App for App {
|
|||
self.node_vec = self.og_node_vec.clone();
|
||||
self.pool_vec = self.og_pool_vec.clone();
|
||||
}
|
||||
if key.is_s() && !wants_input || ui.add_sized([width, height], Button::new("Save")).on_hover_text("Save changes").clicked() {
|
||||
if key.is_s() && !wants_input && self.diff || ui.add_sized([width, height], Button::new("Save")).on_hover_text("Save changes").clicked() {
|
||||
match State::save(&mut self.state, &self.state_path) {
|
||||
Ok(_) => {
|
||||
let mut og = self.og.lock().unwrap();
|
||||
|
|
|
@ -165,7 +165,7 @@ impl SudoState {
|
|||
},
|
||||
}
|
||||
}
|
||||
if let Err(e) = sudo.kill() { error!("Sudo | Kill error: {}", e); }
|
||||
if let Err(e) = sudo.kill() { warn!("Sudo | Kill error (it probably already exited): {}", e); }
|
||||
if state.lock().unwrap().success {
|
||||
match state.lock().unwrap().signal {
|
||||
ProcessSignal::Restart => crate::helper::Helper::restart_xmrig(&helper, &xmrig, &path, Arc::clone(&state)),
|
||||
|
|
Loading…
Reference in a new issue