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)
This commit is contained in:
hinto-janaiyo 2022-12-13 12:51:32 -05:00
parent 9eb49b6dbd
commit 2b80aa0277
No known key found for this signature in database
GPG key ID: B1C5A64B80691E45
5 changed files with 34 additions and 14 deletions

View file

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

View file

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

View file

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

View file

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

View file

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