From 2b80aa027728ddd193bac2e77caa5ddb4323f8fd Mon Sep 17 00:00:00 2001 From: hinto-janaiyo Date: Tue, 13 Dec 2022 12:51:32 -0500 Subject: [PATCH] v0.9.0 Fixes: - Up/Down only work if UI is enabled - Re-pushed [P2POOL_API_PATH] to popped relative path but only after giving the popped path to P2Pool 1. [/tmp/gupax/p2pool/p2pool] -> [/tmp/gupax/p2pool] 2. Give that to P2Pool 3. [/tmp/gupax/p2pool] -> [/tmp/gupax/p2pool/local/stats] 4. Give that to the watchdog (so it can read it) --- CHANGELOG.md | 22 ++++++++++++++++++---- src/README.md | 2 +- src/constants.rs | 4 ++-- src/helper.rs | 4 +++- src/main.rs | 16 ++++++++++------ 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db89f4..05bbc08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,25 @@ - Uptime & Exit status display when process is stopped - Added colors for process state: ``` - GREEN = Process is online and healthy - YELLOW = Process is in the middle of (re)starting/stopping - RED = Process is offline, and failed when exiting - GRAY = Process is offline + GREEN | Process is online and healthy + YELLOW | Process is in the middle of (re)starting/stopping + RED | Process is offline, and failed when exiting + GRAY | Process is offline ``` +* Added keyboard shortcuts: + ``` + *--------------------------------------* + | Key shortcuts | + |--------------------------------------| + | F11 | Fullscreen | + | Escape | Quit screen | + | Left/Right | Switch Tabs | + | Up | Start/Restart | + | Down | Stop | + | S | Save | + | R | Reset | + *--------------------------------------* + ``` * Added `PTY` (actual terminals) for P2Pool/XMRig: - Scrollable logs up to 500k bytes (6000~ lines) before refresh - All STDOUT/STDERR relayed to GUI (buffered, lazily read) diff --git a/src/README.md b/src/README.md index f7aff25..cf3dde6 100644 --- a/src/README.md +++ b/src/README.md @@ -84,7 +84,7 @@ Arti (Tor) also needs to save cache and state. It uses the same file/folder conv Every frame, the max available `[width, height]` are calculated, and those are used as a baseline for the Top/Bottom bars, containing the tabs and status bar. After that, all available space is given to the middle ui elements. The scale is calculated every frame so that all elements can scale immediately as the user adjusts it; this doesn't take as much CPU as you might think since frames are only rendered on user interaction. Some elements are subtracted a fixed number because the `ui.seperator()`'s add some fixed space which needs to be accounted for. ``` -Main [App] outer frame (default: [1280.0, 800.0], 16:10 aspect ratio) +Main [App] outer frame (default: [1280.0, 960.0], 4:3 aspect ratio) ├─ TopPanel = height: 1/12th ├─ BottomPanel = height: 1/20th ├─ CentralPanel = height: the rest diff --git a/src/constants.rs b/src/constants.rs index d61170b..3612d69 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -63,12 +63,12 @@ pub const XMRIG_API_URI: &str = "1/summary"; // The default relative URI of XMRi // Process state tooltips (online, offline, etc) pub const P2POOL_ALIVE: &str = "P2Pool is online"; pub const P2POOL_DEAD: &str = "P2Pool is offline"; -pub const P2POOL_FAILED: &str = "P2Pool is offline, and failed when exiting"; +pub const P2POOL_FAILED: &str = "P2Pool is offline and failed when exiting"; pub const P2POOL_MIDDLE: &str = "P2Pool is in the middle of (re)starting/stopping"; pub const XMRIG_ALIVE: &str = "XMRig is online"; pub const XMRIG_DEAD: &str = "XMRig is offline"; -pub const XMRIG_FAILED: &str = "XMRig is offline, and failed when exiting"; +pub const XMRIG_FAILED: &str = "XMRig is offline and failed when exiting"; pub const XMRIG_MIDDLE: &str = "XMRig is in the middle of (re)starting/stopping"; // This is the typical space added when using diff --git a/src/helper.rs b/src/helper.rs index 2e5dbf4..5a3b9e8 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -369,6 +369,7 @@ impl Helper { out_peers: "10".to_string(), in_peers: "10".to_string(), }; + api_path.push(P2POOL_API_PATH); // [Advanced] } else { @@ -417,7 +418,8 @@ impl Helper { log_level: state.log_level.to_string(), out_peers: state.out_peers.to_string(), in_peers: state.in_peers.to_string(), - } + }; + api_path.push(P2POOL_API_PATH); } } (args, api_path) diff --git a/src/main.rs b/src/main.rs index 16c5a90..61c8386 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1371,14 +1371,16 @@ impl eframe::App for App { }); // Check if address is okay before allowing to start. let mut text = String::new(); + let mut ui_enabled = true; if !Regexes::addr_ok(&self.regex, &self.state.p2pool.address) { - ui.set_enabled(false); + ui_enabled = false; text = P2POOL_ADDRESS.to_string(); } else if !Gupax::path_is_exe(&self.state.gupax.p2pool_path) { - ui.set_enabled(false); + ui_enabled = false; text = P2POOL_PATH_NOT_EXE.to_string(); } - if key.is_up() || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() { + ui.set_enabled(ui_enabled); + if (ui_enabled && key.is_up()) || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() { Helper::start_p2pool(&self.helper, &self.state.p2pool, &self.state.gupax.absolute_p2pool_path); } } @@ -1432,16 +1434,18 @@ impl eframe::App for App { ui.add_sized([width, height], Button::new("⏹")).on_disabled_hover_text("Stop XMRig"); }); let mut text = String::new(); + let mut ui_enabled = true; if !Gupax::path_is_exe(&self.state.gupax.xmrig_path) { - ui.set_enabled(false); + ui_enabled = false; text = XMRIG_PATH_NOT_EXE.to_string(); } + ui.set_enabled(ui_enabled); #[cfg(target_os = "windows")] - if key.is_up() || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() { + if (ui_enabled && key.is_up()) || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() { Helper::start_xmrig(&self.helper, &self.state.xmrig, &self.state.gupax.absolute_xmrig_path, Arc::clone(&self.sudo)); } #[cfg(target_family = "unix")] - if key.is_up() || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() { + if (ui_enabled && key.is_up()) || ui.add_sized([width, height], Button::new("▶")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() { self.sudo.lock().unwrap().signal = ProcessSignal::Start; self.error_state.ask_sudo(&self.sudo); }