//! alkane-toolkit — primary view (docs/UI-SPEC.md). //! Pure-Rust wxWidgets app on the vendored, patched wx-rs. mod access_probe; mod credentials; mod export; mod fixtures; mod i18n; mod logs; mod log_scan; mod model; mod naming; mod pool_prefs; mod presets; mod restore; mod scan; mod ui; fn main() { // Headless workflow self-test: render the bench-fleet fixtures through the // real widgets and check the table + KPIs against the expected hardware // output. Run under a virtual display (see scripts/ui-selftest.sh). if std::env::var_os("ALKANE_SELFTEST").is_some() { std::process::exit(run_selftest()); } // Headless access-probe check: `ALKANE_ACCESS_PROBE=" "` prints the // lock state the real access probe computes (no GUI, no wx), so the WhatsMiner // :4028 token check and the Antminer digest check can be verified directly. if let Some(spec) = std::env::var_os("ALKANE_ACCESS_PROBE") { let spec = spec.to_string_lossy(); let mut it = spec.split_whitespace(); let ip = it.next().unwrap_or(""); let make = it.next().unwrap_or(""); let (user, pass) = credentials::load_credentials().unwrap_or_default(); match access_probe::probe_access(ip, make, &user, &pass) { Ok(Some(true)) => println!("ACCESS {ip} {make}: LOCKED"), Ok(Some(false)) => println!("ACCESS {ip} {make}: UNLOCKED"), Ok(None) => println!("ACCESS {ip} {make}: INDETERMINATE"), Err(e) => println!("ACCESS {ip} {make}: ERROR {e}"), } std::process::exit(0); } // Headless log-scan check: `ALKANE_LOG_SCAN=" "` fetches the miner's // log through asic-rs's per-backend read_logs() (round 19 #11-16), so the log // paths can be verified without the GUI. WhatsMiner falls back to fault codes. if let Some(spec) = std::env::var_os("ALKANE_LOG_SCAN") { let spec = spec.to_string_lossy(); let mut it = spec.split_whitespace(); let ip = it.next().unwrap_or(""); let brand = it.next().unwrap_or(""); match log_scan::scan_log(ip, brand, scan::load_scan_timeout()) { Ok(s) => println!("LOGSCAN {ip} ({brand}): {} log bytes", s.text.len()), Err(e) => println!("LOGSCAN {ip} ({brand}): ERROR {e}"), } std::process::exit(0); } // Load the saved UI language before any strings are built (round 15 #13). i18n::init(); // Bootstrap the wx app + main frame (upstream bridge). wx_rs::init_app("alkane-toolkit", 1280, 800); // Follow the system light/dark appearance. wx_rs::set_appearance_system(); // Build the UI-SPEC primary view into the frame. let frame = wx_rs::Widget::main_frame(); let app = ui::build(frame); ui::install(app); // All widget events funnel through one dispatcher. wx_rs::set_event_handler(ui::dispatch); // Enter the wx event loop; the scan thread streams rows via channel and // a 1 s timer drains it on the main thread. wx_rs::run_app(); } fn run_selftest() -> i32 { // Force offline: never touch the network during the self-test. std::env::set_var(scan::FAKE_SCAN_ENV, "1"); wx_rs::init_app("alkane-toolkit", 1280, 800); let frame = wx_rs::Widget::main_frame(); let mut app = ui::build(frame); let ok = app.run_fixture_selftest(); println!("SELFTEST {}", if ok { "PASS" } else { "FAIL" }); if ok { 0 } else { 1 } }