From 4021f0aacdba316036bf3e8d17630d92607ef7ec Mon Sep 17 00:00:00 2001
From: hinto-janaiyo <hinto.janaiyo@protonmail.com>
Date: Mon, 12 Dec 2022 15:34:49 -0500
Subject: [PATCH]  v0.9.0 (maybe)

---
 CHANGELOG.md     | 40 ++++++++++++++++++++++++++++++++++++----
 Cargo.lock       |  2 +-
 Cargo.toml       |  2 +-
 src/constants.rs |  2 +-
 src/main.rs      |  2 +-
 src/status.rs    |  6 +++---
 6 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 176c2f8..1db89f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,40 @@
-# v0.7.0
-## Prototype Release
+# v0.9.0
+## Beta Release
+* Connected `[Start/Stop/Restart]` buttons to actual processes:
+	- Current state (settings that may or may not be saved) are passed to the process when (re)starting
+	- 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
+		```
+* 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)
+	- `Advanced` tabs have input (STDIN) relayed to process (buffered, 1~sec delay)
+* Added `sudo` screen for XMRig (macOS/Linux):
+	- Tests password for validity
+	- Starts XMRig with `sudo` for MSR mod & hugepages
+	- Wipes password memory with zeros after usage
+* Added `Status` tab:
+	- Refreshes all stats once per second
+	- Gupax/System stats
+	- P2Pool stats via API file
+	- XMRig stats via HTTP API
 * Added `Simple` XMRig tab:
 	- Console
 	- Thread slider
 	- Pause on active slider (Windows/macOS only)
 * Added `Advanced` XMRig tab:
 	- Includes all simple features
+	- STDIN input
 	- Manual pool database, select/add/edit/delete a custom `Name/IP/Port/RigID` (max 1000 pools), saved at:
 	    - Windows: `C:\Users\USER\AppData\Roaming\Gupax\pool.toml`
 	    - macOS: `/Users/USER/Library/Application Support/Gupax/pool.toml`
 	    - Linux: `/home/USER/.local/share/gupax/pool.toml`
-	- Overriding `config.json` option
+	- Overriding command arguments
 	- Manual Monero address option
 	- HTTP API IP/Port option
 	- TLS option
@@ -21,15 +45,23 @@
 	- `Update-via-Tor` setting
 	- `Ask-before-quit` setting
 	- `Save-before-quit` setting
+	- `Auto-P2Pool` setting (starts P2Pool on Gupax startup)
+	- `Auto-XMRig` setting (starts XMRig on Gupax startup)
 * Added `Advanced` Gupax tab:
 	- Includes all simple features
 	- P2Pool binary path selector
 	- XMRig binary path selector
 	- Gupax window width/height adjuster
-* Default resolution change `1280x720, 16:9` -> `1280x800, 16:10`
+	- Startup Tab selector
 * Added plowsof to community nodes:
 	- Plowsof1: `IP: node.monerodevs.org, RPC: 18089, ZMQ: 18084`
 	- Plowsof2: `IP: node2.monerodevs.org, RPC: 18089, ZMQ: 18084`
+* Default resolution change `1280x720, 16:9` -> `1280x960, 4:3`
+* Added fade-in/out of black when resizing resolution
+* Added more internal documentation (`src/README.md`)
+* Added many, many `info` & `debug` logs (accessible via env variable `RUST_LOG`)
+* Bunch of fixes, optimizations, etc.
+
 
 ---
 
diff --git a/Cargo.lock b/Cargo.lock
index 38a9998..2423628 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,7 +4,7 @@ version = 3
 
 [[package]]
 name = "Gupax"
-version = "0.7.0"
+version = "0.9.0"
 dependencies = [
  "anyhow",
  "arti-client",
diff --git a/Cargo.toml b/Cargo.toml
index 7a6dffe..e3b349d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "Gupax"
-version = "0.7.0"
+version = "0.9.0"
 authors = ["hinto-janaiyo <hinto.janaiyo@protonmail.com>"]
 description = "GUI for P2Pool+XMRig"
 documentation = "https://github.com/hinto-janaiyo/gupax"
diff --git a/src/constants.rs b/src/constants.rs
index 76504c4..d172da1 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -16,7 +16,7 @@
 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 pub const GUPAX_VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
-pub const P2POOL_VERSION: &str = "v2.4";
+pub const P2POOL_VERSION: &str = "v2.5";
 pub const XMRIG_VERSION: &str = "v6.18.0";
 pub const COMMIT: &str = include_str!("../.git/refs/heads/main");
 pub const GUPAX_VERSION_UNDERSCORE: &str = concat!("Gupax_", env!("CARGO_PKG_VERSION"));
diff --git a/src/main.rs b/src/main.rs
index 1828976..b0e1c43 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -747,7 +747,7 @@ fn parse_args<S: Into<String>>(mut app: App, panic: S) -> App {
 		match arg.as_str() {
 			"--help"    => { println!("{}", ARG_HELP); exit(0); },
 			"--version" => {
-				println!("Gupax {} [OS: {}, Commit: {}]\n\n{}", GUPAX_VERSION, OS_NAME, &COMMIT[..40], ARG_COPYRIGHT);
+				println!("Gupax {} [OS: {}, Commit: {}]\nThis Gupax was originally bundled with:\n    - P2Pool {}\n    - XMRig {}\n\n{}", GUPAX_VERSION, OS_NAME, &COMMIT[..40], P2POOL_VERSION, XMRIG_VERSION, ARG_COPYRIGHT);
 				exit(0);
 			},
 			"--ferris" => { println!("{}", FERRIS_ANSI); exit(0); },
diff --git a/src/status.rs b/src/status.rs
index fda65bf..e45d4b4 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -43,7 +43,7 @@ pub fn show(sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolApi>>, xmrig_
 	ui.horizontal(|ui| {
 	// [Gupax]
 	ui.group(|ui| { ui.vertical(|ui| {
-		debug!("Status | Rendering [Gupax]");
+		debug!("Status Tab | Rendering [Gupax]");
 		ui.set_min_height(min_height);
 		ui.add_sized([width, height*2.0], Label::new(RichText::new("[Gupax]").color(LIGHT_GRAY).text_style(TextStyle::Name("MonospaceLarge".into())))).on_hover_text("Gupax is online");
 		let sys = sys.lock().unwrap();
@@ -74,10 +74,10 @@ pub fn show(sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolApi>>, xmrig_
 		ui.add_sized([width, height], Label::new(format!("{}", api.shares_found)));
 		ui.add_sized([width, height], Label::new(RichText::new("Payouts").underline().color(BONE))).on_hover_text(STATUS_P2POOL_PAYOUTS);
 		ui.add_sized([width, height], Label::new(format!("Total: {}", api.payouts)));
-		ui.add_sized([width, height], Label::new(format!("[{}/hour] [{}/day] [{}/month]", api.payouts_hour, api.payouts_day, api.payouts_month)));
+		ui.add_sized([width, height], Label::new(format!("[{:.3}/hour] [{:.3}/day] [{:.3}/month]", api.payouts_hour, api.payouts_day, api.payouts_month)));
 		ui.add_sized([width, height], Label::new(RichText::new("XMR Mined").underline().color(BONE))).on_hover_text(STATUS_P2POOL_XMR);
 		ui.add_sized([width, height], Label::new(format!("Total: {} XMR", api.xmr)));
-		ui.add_sized([width, height], Label::new(format!("[{}/hour] [{}/day] [{}/month]", api.xmr_hour, api.xmr_day, api.xmr_month)));
+		ui.add_sized([width, height], Label::new(format!("[{:.3}/hour] [{:.3}/day] [{:.3}/month]", api.xmr_hour, api.xmr_day, api.xmr_month)));
 		ui.add_sized([width, height], Label::new(RichText::new("Hashrate [15m/1h/24h]").underline().color(BONE))).on_hover_text(STATUS_P2POOL_HASHRATE);
 		ui.add_sized([width, height], Label::new(format!("[{} H/s] [{} H/s] [{} H/s]", api.hashrate_15m, api.hashrate_1h, api.hashrate_24h)));
 		ui.add_sized([width, height], Label::new(RichText::new("Miners Connected").underline().color(BONE))).on_hover_text(STATUS_P2POOL_CONNECTIONS);