Skip to content

Commit

Permalink
feat: manage XvB like a new process
Browse files Browse the repository at this point in the history
feat: maj TODO
fix: use Vec2 instead of separating height and witdh as args in functions
feat: status of XvB process
feat: button to autostart XvB process into Gupax Tab
feat: autostart XvB if button is checked
feat: buttons to start/stop/restart XvB process in XvB Tab
feat: check token and address inputs before allowing to start XvB
feat: add description to buttons when hovering
fix: adjust test
feat: function to verify if token exist on XvB API
clippy auto and manual fix
  • Loading branch information
Cyrix126 committed Mar 12, 2024
1 parent bbb61d8 commit 7435560
Show file tree
Hide file tree
Showing 22 changed files with 932 additions and 614 deletions.
23 changes: 12 additions & 11 deletions TODO_XMRvsBeast.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
- [x] link to website
- [ ] message overing explaining registration and needs to read the rules.
- [ ] token input
- [ ] information
- [ ] status of h/s received by the raffle, authenfication by token.
- [ ] hero checkbox
- [ ] log section
- [ ] status of h/s received by the raffle, authentication by token.
- [ ] status of 1h and 24h average h/s sent to raffle from this instance
- [ ] number of failures
- [ ] log section
- [ ] winner of round
- [ ] round in
- [ ] hero checkbox
- [x] status process XvB
- [x] public information from [API](https://xmrvsbeast.com/p2pool/stats)
- [ ] if not enough hashrate for min round and share acquirement OR no share acquired, node destination for xmrig is only p2pool.
- [ ] if share acquired and enough hashrate to keep up round min hashrate and share acquirement, switch node destination for xmrig between p2pool and raffle giving raffle minimum round requirement + buffer.
- [ ] if hero checked, give maximum hasrate to raffle while keeping enough for p2pool.
- [ ] round type in
- [ ] win or loose
- [ ] new process for XvB
- [x] status process XvB
- [x] public information from [API](https://xmrvsbeast.com/p2pool/stats)
- [x] stop, start, restart buttons
- [x] button to autostart
- [ ] distribute hashrate conforming to the algorithm.
- [ ] output log to console in XvB tab
- [ ] edit metadata of project
- [ ] cargo package metadata
- [ ] pgp signatures
15 changes: 12 additions & 3 deletions src/app/eframe_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ impl eframe::App for App {
let xmrig_is_waiting = xmrig.is_waiting();
let xmrig_state = xmrig.state;
drop(xmrig);
debug!("App | Locking and collecting XvB state...");
let xvb = lock!(self.xvb);
let xvb_is_alive = xvb.is_alive();
let xvb_is_waiting = xvb.is_waiting();
let xvb_state = xvb.state;
drop(xvb);

// This sets the top level Ui dimensions.
// Used as a reference for other uis.
debug!("App | Setting width/height");
CentralPanel::default().show(ctx, |ui| {
let available_width = ui.available_width();
if self.width != available_width {
self.width = available_width;
if self.size.x != available_width {
self.size.x = available_width;
if self.now.elapsed().as_secs() > 5 {
self.must_resize = true;
}
};
self.height = ui.available_height();
self.size.y = ui.available_height();
});
self.resize(ctx);

Expand Down Expand Up @@ -77,12 +83,15 @@ impl eframe::App for App {
ctx,
p2pool_state,
xmrig_state,
xvb_state,
&key,
wants_input,
p2pool_is_waiting,
xmrig_is_waiting,
xvb_is_waiting,
p2pool_is_alive,
xmrig_is_alive,
xvb_is_alive,
);
self.middle_panel(ctx, frame, key, p2pool_is_alive, xmrig_is_alive);
}
Expand Down
17 changes: 12 additions & 5 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use crate::APP_DEFAULT_WIDTH;
use crate::GUPAX_VERSION;
use crate::OS;
use eframe::CreationContext;
use egui::vec2;
use egui::Vec2;
use log::debug;
use log::error;
Expand All @@ -61,9 +62,8 @@ pub mod resize;
// actual inner state of the tab settings.
pub struct App {
// Misc state
pub tab: Tab, // What tab are we on?
pub width: f32, // Top-level width
pub height: f32, // Top-level height
pub tab: Tab, // What tab are we on?
pub size: Vec2, // Top-level width and Top-level height
// Alpha (transparency)
// This value is used to incrementally increase/decrease
// the transparency when resizing. Basically, it fades
Expand Down Expand Up @@ -102,6 +102,7 @@ pub struct App {
pub pub_sys: Arc<Mutex<Sys>>, // [Sys] state, read by [Status], mutated by [Helper]
pub p2pool: Arc<Mutex<Process>>, // [P2Pool] process state
pub xmrig: Arc<Mutex<Process>>, // [XMRig] process state
pub xvb: Arc<Mutex<Process>>, // [Xvb] process state
pub p2pool_api: Arc<Mutex<PubP2poolApi>>, // Public ready-to-print P2Pool API made by the "helper" thread
pub xmrig_api: Arc<Mutex<PubXmrigApi>>, // Public ready-to-print XMRig API made by the "helper" thread
pub xvb_api: Arc<Mutex<PubXvbApi>>, // Public XvB API
Expand Down Expand Up @@ -181,6 +182,11 @@ impl App {
String::new(),
PathBuf::new()
));
let xvb = arc_mut!(Process::new(
ProcessName::Xvb,
String::new(),
PathBuf::new()
));
let p2pool_api = arc_mut!(PubP2poolApi::new());
let xmrig_api = arc_mut!(PubXmrigApi::new());
let xvb_api = arc_mut!(PubXvbApi::new());
Expand Down Expand Up @@ -220,8 +226,7 @@ impl App {
let mut app = Self {
tab: Tab::default(),
ping: arc_mut!(Ping::new()),
width: APP_DEFAULT_WIDTH,
height: APP_DEFAULT_HEIGHT,
size: vec2(APP_DEFAULT_WIDTH, APP_DEFAULT_HEIGHT),
must_resize: false,
og: arc_mut!(State::new()),
state: State::new(),
Expand All @@ -244,6 +249,7 @@ impl App {
pub_sys.clone(),
p2pool.clone(),
xmrig.clone(),
xvb.clone(),
p2pool_api.clone(),
xmrig_api.clone(),
xvb_api.clone(),
Expand All @@ -253,6 +259,7 @@ impl App {
)),
p2pool,
xmrig,
xvb,
p2pool_api,
xvb_api,
xmrig_api,
Expand Down
Loading

0 comments on commit 7435560

Please sign in to comment.