fix(gui): per-target credentials for install and restore (#46, #51)
source / check (pull_request) Skipped
verify / verify (pull_request) Failing after 31m29s
source / check (pull_request) Skipped
verify / verify (pull_request) Failing after 31m29s
"Install failed due to credentials" was the #46 change pulling one generic saved SSH login for both directions. Install targets a stock board and restore targets an alkane board, which need different logins. Add the alkane control-board login to the shipped defaults ("Alkane" root/alkane) and a `cred_for(firmware)` helper (saved per-firmware override, else shipped default). Install now uses the selected stock board's firmware login (e.g. AntMiner root/root); restore and the on-board-backup probe use the alkane login (root/alkane). No password field; both overridable per-firmware in Settings. Confirmed on the bench S17 at 10.255.1.111: its alkane login is root/alkane. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
@@ -106,6 +106,9 @@ pub fn clear_credentials() -> std::io::Result<()> {
|
||||
/// duplicated here; a firmware absent from this table defaults to blank.
|
||||
pub fn firmware_default_creds() -> &'static [(&'static str, &'static str, &'static str)] {
|
||||
&[
|
||||
// Alkane OS ships with this control-board login, so restore-to-stock on
|
||||
// an alkane board authenticates with no operator setup (issue #51).
|
||||
("Alkane", "root", "alkane"),
|
||||
("AntMiner Stock", "root", "root"),
|
||||
("WhatsMiner Stock", "admin", "admin"),
|
||||
("Braiins", "root", "root"),
|
||||
@@ -134,6 +137,18 @@ pub fn firmware_default_for(name: &str) -> (String, String) {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The login to use for a board running `firmware`: the operator's saved
|
||||
/// per-firmware override if any, else the shipped default. This is how install
|
||||
/// (a stock target) and restore (an alkane target) each pick the right login
|
||||
/// automatically, without a password field in the dialog (issues #46, #51).
|
||||
pub fn cred_for(firmware: &str) -> (String, String) {
|
||||
load_firmware_credentials()
|
||||
.get(firmware)
|
||||
.cloned()
|
||||
.filter(|(_, p)| !p.is_empty())
|
||||
.unwrap_or_else(|| firmware_default_for(firmware))
|
||||
}
|
||||
|
||||
/// Load the operator's per-firmware credential overrides, keyed by firmware
|
||||
/// Display name. Malformed lines are skipped.
|
||||
pub fn load_firmware_credentials() -> HashMap<String, (String, String)> {
|
||||
|
||||
Reference in New Issue
Block a user