Compare commits

...
4 Commits
Author SHA1 Message Date
noah b1b7a3dbc0 Merge pull request 'SSH login in Credentials; default range 192.168.1.1/24; legal publisher name' (#22) from ssh-login-default-range-publisher into main
build-test-release / windows (push) Successful in 6m15s
build-test-release / release (push) Successful in 14m19s
2026-11-03 12:24:19 -07:00
noahandClaude Opus 5.5 8275f893dd SSH login in the Credentials dialog; default range 192.168.1.1/24; legal publisher name
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 7m55s
verify / verify-windows (pull_request) Successful in 5m8s
- Credentials dialog: new "SSH (restore)" row for the control-board SSH
  login used by the Braiins restore-to-stock. The username defaults to
  root; the password is masked and never re-displayed, and a blank
  password keeps the saved one. Reset to defaults also clears it.
  ssh-credentials.txt no longer has to be written by hand.
- Default scan range is now 192.168.1.1/24 (scans 192.168.1.0/24), and
  the range dialog's examples use that subnet.
- Windows version info, zip README, LICENSE and docs name the publisher
  as on the signing certificate: BlueFlare Energy Solutions Inc.
- Manual updated for all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:08:21 -06:00
noah 36f12d6d4e Merge pull request 'Attribute quality-dashboard coverage to crates' (#21) from fix-crate-coverage into main
build-test-release / release (push) Successful in 13m41s
build-test-release / windows (push) Successful in 5m48s
2026-11-03 10:51:30 -07:00
noahandClaude Opus 5.5 a4d82bf45b Attribute coverage to crates when llvm-cov strips the crates/ prefix
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 9m42s
verify / verify-windows (pull_request) Successful in 6m29s
The quality dashboard put every file under "other" because llvm-cov
prints paths relative to their common prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:34:15 -06:00
13 changed files with 154 additions and 21 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2026 Blueflare Copyright (c) 2026 BlueFlare Energy Solutions Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+6
View File
@@ -174,6 +174,12 @@ def coverage_by_file(summary_path: str | None, root: str) -> list[dict]:
except ValueError: except ValueError:
continue continue
name = cols[0][len(root_abs):] if cols[0].startswith(root_abs) else cols[0] name = cols[0][len(root_abs):] if cols[0].startswith(root_abs) else cols[0]
# llvm-cov drops the prefix every file shares, so when only workspace
# crates are measured "crates/alkane-gui/src/x.rs" is printed as
# "alkane-gui/src/x.rs". Put the prefix back.
first = Path(name).parts[0] if Path(name).parts else ""
if not name.startswith("crates/") and (Path(root) / "crates" / first).is_dir():
name = f"crates/{name}"
rows.append({"file": name, "lines": lines, "missed": missed}) rows.append({"file": name, "lines": lines, "missed": missed})
return rows return rows
+1 -1
View File
@@ -38,7 +38,7 @@ def release(version: str, exe: str, out_dir: str) -> None:
"the executable is self-contained and runs on Windows 10 and 11.\r\n" "the executable is self-contained and runs on Windows 10 and 11.\r\n"
"\r\n" "\r\n"
+ ( + (
"The executable is signed by Blueflare (Azure Artifact Signing). To check:\r\n" "The executable is signed by BlueFlare Energy Solutions Inc. (Azure Artifact Signing). To check:\r\n"
"right-click alkane-toolkit.exe > Properties > Digital Signatures.\r\n" "right-click alkane-toolkit.exe > Properties > Digital Signatures.\r\n"
if signed else if signed else
"This build is not code-signed, so Windows SmartScreen may warn on first\r\n" "This build is not code-signed, so Windows SmartScreen may warn on first\r\n"
+11
View File
@@ -81,6 +81,17 @@ class BenchBadgeTests(unittest.TestCase):
self.assertEqual(rows[0]["missed"], 60) self.assertEqual(rows[0]["missed"], 60)
self.assertEqual(gen_badges.crate_of(rows[1]["file"]), "alkane-core") self.assertEqual(gen_badges.crate_of(rows[1]["file"]), "alkane-core")
def test_coverage_table_restores_the_stripped_crates_prefix(self):
with tempfile.TemporaryDirectory(prefix="alkane-cov-") as directory:
(Path(directory) / "crates" / "alkane-cli").mkdir(parents=True)
summary = Path(directory) / "summary.txt"
summary.write_text(
"alkane-cli/src/main.rs 4 4 0.00% 1 1 0.00% 23 23 0.00%\n")
rows = gen_badges.coverage_by_file(str(summary), directory)
self.assertEqual(rows[0], {"file": "crates/alkane-cli/src/main.rs",
"lines": 23, "missed": 23})
self.assertEqual(gen_badges.crate_of(rows[0]["file"]), "alkane-cli")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
+38 -3
View File
@@ -69,13 +69,26 @@ pub fn load_ssh_credentials() -> Option<(String, String)> {
load_creds_file(SSH_CREDENTIALS_FILE) load_creds_file(SSH_CREDENTIALS_FILE)
} }
/// Save the SSH username/password (0600). Retained for a future SSH-login dialog /// Save the SSH username/password (0600), from the Credentials dialog.
/// now that the SSH PIC probe that used to save it has been removed (round 14 #5).
#[allow(dead_code)]
pub fn save_ssh_credentials(user: &str, pass: &str) -> std::io::Result<()> { pub fn save_ssh_credentials(user: &str, pass: &str) -> std::io::Result<()> {
save_creds_file(SSH_CREDENTIALS_FILE, user, pass) save_creds_file(SSH_CREDENTIALS_FILE, user, pass)
} }
/// Remove the saved SSH login, if any. Not an error if none was saved.
pub fn clear_ssh_credentials() -> std::io::Result<()> {
clear_creds_file(SSH_CREDENTIALS_FILE)
}
/// The SSH username to use: the saved one, or `root` (the control-board login
/// on every firmware the restore flow drives over SSH) when none was entered.
pub fn ssh_user_or_default(user: &str) -> String {
if user.trim().is_empty() {
"root".to_string()
} else {
user.trim().to_string()
}
}
/// Remove the saved web/API credentials, if any. Not an error if none were saved. /// Remove the saved web/API credentials, if any. Not an error if none were saved.
pub fn clear_credentials() -> std::io::Result<()> { pub fn clear_credentials() -> std::io::Result<()> {
match clear_creds_file(CREDENTIALS_FILE) { match clear_creds_file(CREDENTIALS_FILE) {
@@ -272,6 +285,28 @@ mod tests {
assert_eq!(load_credentials(), None, "cleared -> None"); assert_eq!(load_credentials(), None, "cleared -> None");
clear_credentials().unwrap(); // idempotent: clearing an already-clear store is not an error clear_credentials().unwrap(); // idempotent: clearing an already-clear store is not an error
// SSH login: separate file, same 0600 rule, clear is idempotent.
assert_eq!(load_ssh_credentials(), None, "no SSH file -> None");
save_ssh_credentials("root", "ssh-pass").unwrap();
assert_owner_only(
&config_path(SSH_CREDENTIALS_FILE),
"SSH creds file must be 0600",
);
assert_eq!(
load_ssh_credentials(),
Some(("root".to_string(), "ssh-pass".to_string()))
);
assert_eq!(
load_credentials(),
None,
"SSH save leaves the web login alone"
);
clear_ssh_credentials().unwrap();
assert_eq!(load_ssh_credentials(), None, "cleared -> None");
clear_ssh_credentials().unwrap();
assert_eq!(ssh_user_or_default(""), "root");
assert_eq!(ssh_user_or_default(" admin "), "admin");
// Per-firmware overrides (round 12 #13). Kept in this same test because // Per-firmware overrides (round 12 #13). Kept in this same test because
// HOME is process-global: a second #[test] mutating it would race under // HOME is process-global: a second #[test] mutating it would race under
// cargo's default parallel runner. // cargo's default parallel runner.
+1 -1
View File
@@ -245,7 +245,7 @@ fn restore_braiins(ip: &str, user: &str, pass: &str) -> (bool, String) {
if pass.is_empty() { if pass.is_empty() {
return ( return (
false, false,
"Braiins restore needs an SSH password (set the SSH login)".into(), "Braiins restore needs an SSH password (Credentials > SSH)".into(),
); );
} }
let target = format!("{user}@{ip}"); let target = format!("{user}@{ip}");
+10 -1
View File
@@ -86,7 +86,9 @@ pub fn save_scan_concurrency(n: usize) -> std::io::Result<()> {
.to_string(), .to_string(),
) )
} }
pub const DEFAULT_RANGE: &str = "10.255.1.0/24"; /// The usual home/site router subnet. Host bits are masked off, so this scans
/// 192.168.1.0/24.
pub const DEFAULT_RANGE: &str = "192.168.1.1/24";
/// Default seconds between automatic rescans. /// Default seconds between automatic rescans.
pub const DEFAULT_AUTO_SECS: u64 = 300; pub const DEFAULT_AUTO_SECS: u64 = 300;
@@ -2267,6 +2269,13 @@ mod tests {
); );
} }
#[test]
fn default_range_covers_the_whole_192_168_1_subnet() {
let ips = parse_line(DEFAULT_RANGE).unwrap();
let cidrs = targets_to_cidrs(&ips);
assert_eq!(cidrs, vec![(Ipv4Addr::new(192, 168, 1, 0), 24)]);
}
#[test] #[test]
fn cidr_aggregation_round_trips() { fn cidr_aggregation_round_trips() {
// a /24 must aggregate back to exactly one /24 block // a /24 must aggregate back to exactly one /24 block
+71 -2
View File
@@ -770,6 +770,8 @@ pub struct App {
// Credentials dialog (round 13 #2). Empty when no global credential is set. // Credentials dialog (round 13 #2). Empty when no global credential is set.
creds_user_input: Widget, creds_user_input: Widget,
creds_pass_input: Widget, creds_pass_input: Widget,
ssh_user_input: Widget,
ssh_pass_input: Widget,
// The Credentials dialog (round 13 #2): the global login above plus one // The Credentials dialog (round 13 #2): the global login above plus one
// (firmware name, user field, pass field) row per registry firmware. // (firmware name, user field, pass field) row per registry firmware.
fwcreds_dialog: Widget, fwcreds_dialog: Widget,
@@ -1138,6 +1140,8 @@ pub fn build(frame: Widget) -> App {
header_menu_col: None, header_menu_col: None,
creds_user_input: frame, creds_user_input: frame,
creds_pass_input: frame, creds_pass_input: frame,
ssh_user_input: frame,
ssh_pass_input: frame,
fwcreds_dialog: frame, fwcreds_dialog: frame,
fwcreds_rows: Vec::new(), fwcreds_rows: Vec::new(),
access_probe: None, access_probe: None,
@@ -2355,6 +2359,7 @@ impl App {
vnish_pass vnish_pass
}; };
let (ssh_user, ssh_pass) = credentials::load_ssh_credentials().unwrap_or_default(); let (ssh_user, ssh_pass) = credentials::load_ssh_credentials().unwrap_or_default();
let ssh_user = credentials::ssh_user_or_default(&ssh_user);
let ips: Vec<String> = targets.iter().map(|t| t.ip.clone()).collect(); let ips: Vec<String> = targets.iter().map(|t| t.ip.clone()).collect();
self.restore_dialog.close(1); self.restore_dialog.close(1);
crate::logs::log(format!("restore {} miner(s) to stock", ips.len())); crate::logs::log(format!("restore {} miner(s) to stock", ips.len()));
@@ -3112,6 +3117,52 @@ impl App {
); );
self.creds_user_input = user_input; self.creds_user_input = user_input;
self.creds_pass_input = pass_input; self.creds_pass_input = pass_input;
// SSH login for the control board (Braiins restore-to-stock). Same rule
// as the global login: the password is never shown, blank keeps it.
let (ssh_user, ssh_pass) = credentials::load_ssh_credentials().unwrap_or_default();
let s_hint = if ssh_pass.is_empty() {
"SSH (restore)"
} else {
"SSH (password saved; blank keeps it)"
};
let srow = Widget::box_sizer(false);
let slabel = Widget::static_text(dlg, s_hint);
slabel.set_min_size(150, -1);
srow.add(
slabel,
0,
sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT,
6,
);
let ssh_user_input = Widget::text_ctrl(dlg, false);
ssh_user_input.set_min_size(150, -1);
ssh_user_input.set_value(if ssh_user.is_empty() {
"root"
} else {
&ssh_user
});
srow.add(
ssh_user_input,
0,
sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT,
6,
);
let ssh_pass_input = Widget::password_ctrl(dlg);
ssh_pass_input.set_min_size(150, -1);
srow.add(
ssh_pass_input,
1,
sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT,
6,
);
root.add_sizer(
srow,
0,
sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP,
6,
);
self.ssh_user_input = ssh_user_input;
self.ssh_pass_input = ssh_pass_input;
// Column headers. // Column headers.
let head = Widget::box_sizer(false); let head = Widget::box_sizer(false);
let h_fw = Widget::static_text(dlg, "Firmware"); let h_fw = Widget::static_text(dlg, "Firmware");
@@ -3223,6 +3274,21 @@ impl App {
wx_rs::set_status_text(&format!("failed to save global login: {e}")); wx_rs::set_status_text(&format!("failed to save global login: {e}"));
return; return;
} }
// SSH login: a blank password keeps the saved one; with nothing saved
// and no password entered there is nothing to store.
let s_user = credentials::ssh_user_or_default(&self.ssh_user_input.get_value());
let s_pass = self.ssh_pass_input.get_value();
let ssh_result = if !s_pass.is_empty() {
credentials::save_ssh_credentials(&s_user, &s_pass)
} else if let Some((_, saved)) = credentials::load_ssh_credentials() {
credentials::save_ssh_credentials(&s_user, &saved)
} else {
Ok(())
};
if let Err(e) = ssh_result {
wx_rs::set_status_text(&format!("failed to save SSH login: {e}"));
return;
}
// Per-firmware overrides. // Per-firmware overrides.
let mut map: std::collections::HashMap<String, (String, String)> = let mut map: std::collections::HashMap<String, (String, String)> =
std::collections::HashMap::new(); std::collections::HashMap::new();
@@ -3259,6 +3325,8 @@ impl App {
fn apply_firmware_creds_reset(&mut self) { fn apply_firmware_creds_reset(&mut self) {
self.creds_user_input.set_value(""); self.creds_user_input.set_value("");
self.creds_pass_input.set_value(""); self.creds_pass_input.set_value("");
self.ssh_user_input.set_value("root");
self.ssh_pass_input.set_value("");
for (name, user_ctrl, pass_ctrl) in &self.fwcreds_rows { for (name, user_ctrl, pass_ctrl) in &self.fwcreds_rows {
let (user, pass) = credentials::firmware_default_for(name); let (user, pass) = credentials::firmware_default_for(name);
user_ctrl.set_value(&user); user_ctrl.set_value(&user);
@@ -3266,7 +3334,8 @@ impl App {
} }
let per_fw = credentials::clear_firmware_credentials(); let per_fw = credentials::clear_firmware_credentials();
let global = credentials::clear_credentials(); let global = credentials::clear_credentials();
match per_fw.and(global) { let ssh = credentials::clear_ssh_credentials();
match per_fw.and(global).and(ssh) {
Ok(()) => wx_rs::set_status_text("credentials reset to defaults"), Ok(()) => wx_rs::set_status_text("credentials reset to defaults"),
Err(e) => wx_rs::set_status_text(&format!("failed to reset credentials: {e}")), Err(e) => wx_rs::set_status_text(&format!("failed to reset credentials: {e}")),
} }
@@ -3878,7 +3947,7 @@ impl App {
let edit = Widget::text_ctrl(dlg, true); let edit = Widget::text_ctrl(dlg, true);
edit.set_value(&scan::load_ranges().join("\n")); edit.set_value(&scan::load_ranges().join("\n"));
edit.set_tool_tip( edit.set_tool_tip(
"One range per line:\n CIDR 10.255.1.0/24\n range 10.253.1.3-10.253.1.234\n single 10.253.1.5", "One range per line:\n CIDR 192.168.1.0/24\n range 192.168.1.3-192.168.1.234\n single 192.168.1.5",
); );
root.add(edit, 1, sf::EXPAND | sf::BORDER_ALL, 6); root.add(edit, 1, sf::EXPAND | sf::BORDER_ALL, 6);
// Auto-rescan interval (seconds; 0 = off) and per-miner scan timeout. // Auto-rescan interval (seconds; 0 = off) and per-miner scan timeout.
+2 -2
View File
@@ -25,11 +25,11 @@ BEGIN
BEGIN BEGIN
BLOCK "040904B0" BLOCK "040904B0"
BEGIN BEGIN
VALUE "CompanyName", "Blueflare" VALUE "CompanyName", "BlueFlare Energy Solutions Inc."
VALUE "FileDescription", "Alkane Toolkit" VALUE "FileDescription", "Alkane Toolkit"
VALUE "FileVersion", ALKANE_VER_STR VALUE "FileVersion", ALKANE_VER_STR
VALUE "InternalName", "alkane-toolkit" VALUE "InternalName", "alkane-toolkit"
VALUE "LegalCopyright", "Copyright (c) 2026 Blueflare (MIT License)" VALUE "LegalCopyright", "Copyright (c) 2026 BlueFlare Energy Solutions Inc. (MIT License)"
VALUE "OriginalFilename", "alkane-toolkit.exe" VALUE "OriginalFilename", "alkane-toolkit.exe"
VALUE "ProductName", "Alkane Toolkit" VALUE "ProductName", "Alkane Toolkit"
VALUE "ProductVersion", ALKANE_VER_STR VALUE "ProductVersion", ALKANE_VER_STR
+2 -2
View File
@@ -33,8 +33,8 @@ tar xzf alkane-toolkit-vX.Y.Z-linux-x86_64.tar.gz
## First run ## First run
The toolkit starts a scan as soon as it opens. Set your own ranges first with The toolkit starts a scan as soon as it opens. Set your own ranges first with
**Scan ranges** (see [Scanning](02-scanning.md)); until you do, it scans a **Scan ranges** (see [Scanning](02-scanning.md)); until you do, it scans
built-in default range. 192.168.1.0/24, the usual router subnet.
To look around without touching any miner, start it in demo mode. It shows a To look around without touching any miner, start it in demo mode. It shows a
built-in sample fleet and simulates every action: built-in sample fleet and simulates every action:
+9 -6
View File
@@ -5,11 +5,13 @@
## Credentials ## Credentials
Miners need a login for anything beyond basic discovery: for some details, and Miners need a login for anything beyond basic discovery: for some details, and
for every action. The Credentials dialog has two parts: for every action. The Credentials dialog has three parts:
- **All firmwares** at the top: one username and password tried on every miner. - **All firmwares** at the top: one username and password tried on every miner.
The saved password is never shown; leave the field blank to keep it. Blank The saved password is never shown; leave the field blank to keep it. Blank
username and password clear it. username and password clear it.
- **SSH (restore)**: the control-board SSH login used to restore Braiins OS to
stock (see [SSH login](#ssh-login)).
- **One row per firmware**, pre-filled with that firmware's factory default. - **One row per firmware**, pre-filled with that firmware's factory default.
Change a row to override the login for that firmware only. Change a row to override the login for that firmware only.
@@ -31,7 +33,8 @@ then the firmware's built-in default.
| SealMiner Stock | seal / seal | | SealMiner Stock | seal / seal |
| Auradine Stock | admin / admin | | Auradine Stock | admin / admin |
**Reset to defaults** clears every override and the global login at once. **Reset to defaults** clears every override, the global login and the SSH
login at once.
Logins are stored as plain text in the settings folder, readable only by your Logins are stored as plain text in the settings folder, readable only by your
user account (Linux file mode 0600; on Windows, your profile folder's user account (Linux file mode 0600; on Windows, your profile folder's
@@ -40,9 +43,9 @@ permissions).
### SSH login ### SSH login
Restoring Braiins to stock runs a command over SSH, using the system `ssh` Restoring Braiins to stock runs a command over SSH, using the system `ssh`
client (built into Windows 10/11). There is no dialog for this login yet: client (built into Windows 10/11). Set its login in the **SSH (restore)** row
create `ssh-credentials.txt` in the settings folder with the username on the of the Credentials dialog. The username defaults to `root`. As with the global
first line and the password on the second. login, the saved password is never shown and a blank password keeps it.
## Language ## Language
@@ -63,7 +66,7 @@ the current session (the last 2000 lines). Times are shown in UTC.
| `auto-rescan-secs.txt`, `scan-timeout-secs.txt`, `scan-concurrency.txt` | the three scan numbers | | `auto-rescan-secs.txt`, `scan-timeout-secs.txt`, `scan-concurrency.txt` | the three scan numbers |
| `scan-credentials.txt` | global login | | `scan-credentials.txt` | global login |
| `firmware-credentials.txt` | per-firmware logins | | `firmware-credentials.txt` | per-firmware logins |
| `ssh-credentials.txt` | SSH login (created by hand) | | `ssh-credentials.txt` | SSH login |
| `presets.json` | saved views | | `presets.json` | saved views |
| `language.txt` | UI language | | `language.txt` | UI language |
| `pool-addresses.txt`, `pool-accounts.txt`, `pool-workers.txt`, `pool-passwords.txt` | saved pool values | | `pool-addresses.txt`, `pool-accounts.txt`, `pool-workers.txt`, `pool-passwords.txt` | saved pool values |
+1 -1
View File
@@ -11,7 +11,7 @@ confirmation with the list of miners first.
|---|---|---| |---|---|---|
| VNish (and builds based on it) | web API: unlock, then remove firmware; reboots in seconds | the VNish row in Credentials, else `admin` | | VNish (and builds based on it) | web API: unlock, then remove firmware; reboots in seconds | the VNish row in Credentials, else `admin` |
| LuxOS | miner API: log on, then uninstall | none | | LuxOS | miner API: log on, then uninstall | none |
| Braiins OS | SSH: runs the firmware's own `uninstall.sh` | `ssh-credentials.txt` (see [Settings](06-settings.md)) | | Braiins OS | SSH: runs the firmware's own `uninstall.sh` | the SSH row in Credentials (see [Settings](06-settings.md#ssh-login)) |
Miners are restored one at a time. A dropped connection after the command is Miners are restored one at a time. A dropped connection after the command is
sent counts as success, because that is the reboot. A refused login counts as sent counts as success, because that is the reboot. A refused login counts as
+1 -1
View File
@@ -63,7 +63,7 @@ credential; the script pins the new digest everywhere.
Release and `-rc` executables are Authenticode-signed with Azure Artifact Release and `-rc` executables are Authenticode-signed with Azure Artifact
Signing (formerly Trusted Signing), so Windows and SmartScreen show Signing (formerly Trusted Signing), so Windows and SmartScreen show
"Blueflare" as the verified publisher instead of "Unknown publisher". "BlueFlare Energy Solutions Inc." as the verified publisher instead of "Unknown publisher".
| Piece | Where | | Piece | Where |
|-------|-------| |-------|-------|