mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
status: link helper & GUI's XMRig API
This commit is contained in:
parent
e2f6d90476
commit
bf4e39c3a5
4 changed files with 32 additions and 13 deletions
|
@ -15,11 +15,11 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
pub const GUPAX: &str = concat!("Gupax ", env!("CARGO_PKG_VERSION"));
|
||||
pub const GUPAX_VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
|
||||
pub const P2POOL_VERSION: &str = "v2.4";
|
||||
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"));
|
||||
|
||||
// App frame resolution, [4:3] aspect ratio, [1.33:1]
|
||||
pub const APP_MIN_WIDTH: f32 = 640.0;
|
||||
|
@ -126,6 +126,13 @@ pub const STATUS_P2POOL_HASHRATE: &str = "The total amount of hashrate your P2Po
|
|||
pub const STATUS_P2POOL_SHARES: &str = "The total amount of shares found on P2Pool";
|
||||
pub const STATUS_P2POOL_EFFORT: &str = "The average amount of effort needed to find a share, and the current effort";
|
||||
pub const STATUS_P2POOL_CONNECTIONS: &str = "The total amount of miner connections on this P2Pool";
|
||||
//--
|
||||
pub const STATUS_XMRIG_UPTIME: &str = "How long XMRig has been online";
|
||||
pub const STATUS_XMRIG_CPU: &str = "The average CPU load of XMRig";
|
||||
pub const STATUS_XMRIG_HASHRATE: &str = "The average hashrate of XMRig";
|
||||
pub const STATUS_XMRIG_DIFFICULTY: &str = "The current difficulty of the job XMRig is working on";
|
||||
pub const STATUS_XMRIG_SHARES: &str = "The amount of accepted and rejected shares";
|
||||
pub const STATUS_XMRIG_POOL: &str = "The pool XMRig is currently mining to";
|
||||
|
||||
// Gupax
|
||||
pub const GUPAX_UPDATE: &str = "Check for updates on Gupax, P2Pool, and XMRig via GitHub's API and upgrade automatically";
|
||||
|
|
|
@ -665,7 +665,7 @@ impl Helper {
|
|||
// [Simple]
|
||||
if state.simple {
|
||||
// Build the xmrig argument
|
||||
let rig = if state.simple_rig.is_empty() { GUPAX.to_string() } else { state.simple_rig.clone() }; // Rig name
|
||||
let rig = if state.simple_rig.is_empty() { GUPAX_VERSION_UNDERSCORE.to_string() } else { state.simple_rig.clone() }; // Rig name
|
||||
args.push("--url".to_string()); args.push("127.0.0.1:3333".to_string()); // Local P2Pool (the default)
|
||||
args.push("--threads".to_string()); args.push(state.current_threads.to_string()); // Threads
|
||||
args.push("--user".to_string()); args.push(rig.clone()); // Rig name
|
||||
|
@ -869,7 +869,9 @@ impl Helper {
|
|||
|
||||
// Send an HTTP API request
|
||||
if let Ok(priv_api) = PrivXmrigApi::request_xmrig_api(client.clone(), &api_ip_port).await {
|
||||
PubXmrigApi::from_priv(&mut pub_api.lock().unwrap(), priv_api);
|
||||
PubXmrigApi::update_from_priv(&pub_api, priv_api);
|
||||
} else {
|
||||
warn!("XMRig | Could not send HTTP API request to: {}", api_ip_port);
|
||||
}
|
||||
|
||||
// Check if logs need resetting
|
||||
|
@ -1483,9 +1485,9 @@ impl PubXmrigApi {
|
|||
}
|
||||
|
||||
// Formats raw private data into ready-to-print human readable version.
|
||||
fn from_priv(public: &mut Self, private: PrivXmrigApi) {
|
||||
fn update_from_priv(public: &Arc<Mutex<Self>>, private: PrivXmrigApi) {
|
||||
let mut public = public.lock().unwrap();
|
||||
*public = Self {
|
||||
uptime: HumanTime::new(),
|
||||
worker_id: private.worker_id,
|
||||
resources: HumanNumber::from_load(private.resources.load_average),
|
||||
hashrate: HumanNumber::from_hashrate(private.hashrate.total),
|
||||
|
@ -1493,7 +1495,7 @@ impl PubXmrigApi {
|
|||
diff: HumanNumber::from_u128(private.connection.diff),
|
||||
accepted: HumanNumber::from_u128(private.connection.accepted),
|
||||
rejected: HumanNumber::from_u128(private.connection.rejected),
|
||||
..std::mem::take(public)
|
||||
..std::mem::take(&mut *public)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -923,7 +923,7 @@ impl eframe::App for App {
|
|||
match self.error_state.buttons {
|
||||
StayQuit => {
|
||||
let mut text = "".to_string();
|
||||
if *self.update.lock().unwrap().updating.lock().unwrap() { text = format!("{}\nUpdate is in progress...!", text); }
|
||||
if *self.update.lock().unwrap().updating.lock().unwrap() { text = format!("{}\nUpdate is in progress...! Quitting may cause file corruption!", text); }
|
||||
if self.p2pool.lock().unwrap().is_alive() { text = format!("{}\nP2Pool is online...!", text); }
|
||||
if self.xmrig.lock().unwrap().is_alive() { text = format!("{}\nXMRig is online...!", text); }
|
||||
ui.add_sized([width, height], Label::new("--- Are you sure you want to quit? ---"));
|
||||
|
|
|
@ -44,7 +44,6 @@ pub fn show(sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolApi>>, xmrig_
|
|||
ui.group(|ui| { ui.vertical(|ui| {
|
||||
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");
|
||||
// Uptime
|
||||
let sys = sys.lock().unwrap();
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Uptime").underline().color(BONE))).on_hover_text(STATUS_GUPAX_UPTIME);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", sys.gupax_uptime)));
|
||||
|
@ -65,7 +64,6 @@ pub fn show(sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolApi>>, xmrig_
|
|||
ui.set_enabled(p2pool_online);
|
||||
ui.set_min_height(min_height);
|
||||
ui.add_sized([width, height*2.0], Label::new(RichText::new("[P2Pool]").color(LIGHT_GRAY).text_style(TextStyle::Name("MonospaceLarge".into())))).on_hover_text("P2Pool is online").on_disabled_hover_text("P2Pool is offline");
|
||||
// Uptime
|
||||
let api = p2pool_api.lock().unwrap();
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Uptime").underline().color(BONE))).on_hover_text(STATUS_P2POOL_UPTIME);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.uptime)));
|
||||
|
@ -77,21 +75,33 @@ pub fn show(sys: &Arc<Mutex<Sys>>, p2pool_api: &Arc<Mutex<PubP2poolApi>>, xmrig_
|
|||
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(RichText::new("P2Pool Hashrate [15m/1h/24h]").underline().color(BONE))).on_hover_text(STATUS_P2POOL_HASHRATE);
|
||||
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);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.connections)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Effort").underline().color(BONE))).on_hover_text(STATUS_P2POOL_EFFORT);
|
||||
ui.add_sized([width, height], Label::new(format!("[Average: {}] [Current: {}]", api.average_effort, api.current_effort)));
|
||||
drop(api);
|
||||
})});
|
||||
// [XMRig]
|
||||
ui.group(|ui| { ui.vertical(|ui| {
|
||||
ui.set_enabled(xmrig_online);
|
||||
ui.set_min_height(min_height);
|
||||
ui.add_sized([width, height*2.0], Label::new(RichText::new("[XMRig]").color(LIGHT_GRAY).text_style(TextStyle::Name("MonospaceLarge".into())))).on_hover_text("XMRig is online").on_disabled_hover_text("XMRig is offline");
|
||||
// Uptime
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Uptime").underline()));
|
||||
ui.add_sized([width, height], Label::new(format!("{}", xmrig_api.lock().unwrap().uptime)));
|
||||
let api = xmrig_api.lock().unwrap();
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Uptime").underline().color(BONE))).on_hover_text(STATUS_XMRIG_UPTIME);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.uptime)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("CPU Load Averages").underline().color(BONE))).on_hover_text(STATUS_XMRIG_CPU);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.resources)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Hashrate Averages").underline().color(BONE))).on_hover_text(STATUS_XMRIG_HASHRATE);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.hashrate)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Difficulty").underline().color(BONE))).on_hover_text(STATUS_XMRIG_DIFFICULTY);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.diff)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Shares").underline().color(BONE))).on_hover_text(STATUS_XMRIG_SHARES);
|
||||
ui.add_sized([width, height], Label::new(format!("[Accepted: {}] [Rejected: {}]", api.accepted, api.rejected)));
|
||||
ui.add_sized([width, height], Label::new(RichText::new("Pool").underline().color(BONE))).on_hover_text(STATUS_XMRIG_POOL);
|
||||
ui.add_sized([width, height], Label::new(format!("{}", api.pool)));
|
||||
drop(api);
|
||||
})});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue