feat(gui): install picker reads any repo with board-compat filtering
source / check (pull_request) Skipped
verify / verify-windows (pull_request) Canceled after 0s
verify / verify (pull_request) Canceled after 1m5s

The install dialog gains a "Release repo (owner/repo)" field (default
blueflare/alkane-os) and a Reload button. Releases are scanned from the chosen
repo via ReleaseSource::for_repo and filtered to those with an .afw compatible
with the target board (ReleaseInfo::is_compatible_with). Verified under a
virtual display: the picker populates with the alkane-os release unauthenticated
now that the repo is public, and the repo field + Reload render.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
2026-11-13 10:59:10 -06:00
co-authored by Claude Opus 4.8
parent fbf44889ea
commit 7d5f250254
+101 -31
View File
@@ -110,6 +110,8 @@ const ID_INSTALL_CANCEL: i32 = 1007;
const ID_INSTALL_RELEASE_CHOICE: i32 = 1008;
// Browse for a local .afw to install instead of a scanned Gitea release.
const ID_INSTALL_BROWSE: i32 = 1011;
// Reload the release picker from the repo typed in the install dialog.
const ID_INSTALL_RELOAD: i32 = 1012;
const ID_UNINSTALL_OK: i32 = 1009;
const ID_UNINSTALL_CANCEL: i32 = 1010;
// Pool-preset manager dialog (round 18 #8b): edit the whole saved list at once.
@@ -958,6 +960,9 @@ pub struct App {
// A read-only flash-plan checklist (tier + which regions are overwritten),
// filled from a picked local .afw's manifest.
install_plan_label: Widget,
// The release repo (owner/repo) the picker scans; defaults to
// blueflare/alkane-os, editable + reloadable to any compatible repo.
install_repo_input: Widget,
uninstall_dialog: Widget,
uninstall_pass_input: Widget,
uninstall_firmware_input: Widget,
@@ -1349,6 +1354,7 @@ pub fn build(frame: Widget) -> App {
install_local_path: None,
install_local_label: frame,
install_plan_label: frame,
install_repo_input: frame,
uninstall_dialog: frame,
uninstall_pass_input: frame,
uninstall_firmware_input: frame,
@@ -2675,6 +2681,67 @@ impl App {
/// alkane-os releases to pick from, an optional board credential, the
/// allow-unsigned (bench) toggle, and a typed FLASH confirmation. The install
/// runs over the network via the toolkit's own compiled-in from-stock engine.
/// Scan `owner/repo`'s releases and fill the install picker with the ones
/// that carry an .afw compatible with the target board (newest first). Called
/// when the dialog opens and from the Reload button. Requires
/// `install_release_choice` to already exist.
fn populate_install_releases(&mut self, owner: &str, repo: &str) {
let board = self.install_board.clone();
wx_rs::set_status_text(&format!("scanning {owner}/{repo} releases..."));
let releases: Vec<ReleaseInfo> =
match fetch::list_releases(&ReleaseSource::for_repo(owner, repo)) {
Ok(list) => list
.into_iter()
.filter(|r| !r.draft && r.is_compatible_with(&board))
.collect(),
Err(e) => {
wx_rs::set_status_text(&format!("could not list {owner}/{repo} releases: {e}"));
Vec::new()
}
};
self.install_releases = releases;
let choice = self.install_release_choice;
choice.choice_clear();
if self.install_releases.is_empty() {
choice.choice_append(&format!(
"(no release with an .afw for {board} in {owner}/{repo})"
));
} else {
for (i, r) in self.install_releases.iter().enumerate() {
let tag = if r.tag.is_empty() {
r.name.as_str()
} else {
r.tag.as_str()
};
let kind = if r.prerelease { " [pre-release]" } else { "" };
let latest = if i == 0 { " (latest)" } else { "" };
let date = r.published_at.split('T').next().unwrap_or("");
choice.choice_append(&format!("{tag}{kind} {date}{latest}"));
}
choice.choice_set_selection(0);
}
wx_rs::set_status_text(&format!(
"{} release(s) for {board} in {owner}/{repo}",
self.install_releases.len()
));
}
/// Reload the install picker from the owner/repo currently typed in the
/// dialog's repo field (default blueflare/alkane-os if blank/malformed).
fn reload_install_repo(&mut self) {
let raw = self.install_repo_input.get_value();
let raw = raw.trim();
let (owner, repo) = raw.split_once('/').unwrap_or(("blueflare", "alkane-os"));
let owner = owner.trim();
let repo = repo.trim();
if owner.is_empty() || repo.is_empty() {
self.populate_install_releases("blueflare", "alkane-os");
} else {
self.populate_install_releases(owner, repo);
}
self.install_dialog.layout();
}
fn build_install_dialog(&mut self, update: bool) -> Option<Widget> {
if self.hardware_busy() {
wx_rs::set_status_text("busy -- try again once the current operation finishes");
@@ -2687,21 +2754,10 @@ impl App {
}
let board = self.install_board.clone();
// Scan alkane-os releases from Gitea (newest first), keeping those that
// carry an .afw for this board. One quick API call, done synchronously so
// the picker is populated when the dialog opens.
wx_rs::set_status_text("scanning alkane-os releases...");
let releases: Vec<ReleaseInfo> = match fetch::list_releases(&ReleaseSource::alkane_os()) {
Ok(list) => list
.into_iter()
.filter(|r| !r.draft && r.asset_for_board(&board).is_some())
.collect(),
Err(e) => {
wx_rs::set_status_text(&format!("could not list releases: {e}"));
Vec::new()
}
};
self.install_releases = releases;
// Releases are scanned after the picker widget exists, from the repo in
// the repo field (default blueflare/alkane-os); see
// populate_install_releases, which the Reload button also calls.
self.install_releases = Vec::new();
self.install_ips = ips.clone();
self.install_local_path = None;
@@ -2753,22 +2809,6 @@ impl App {
12,
);
let choice = Widget::choice(dlg, ID_INSTALL_RELEASE_CHOICE);
if self.install_releases.is_empty() {
choice.choice_append("(no release with an .afw for this board was found)");
} else {
for (i, r) in self.install_releases.iter().enumerate() {
let tag = if r.tag.is_empty() {
r.name.as_str()
} else {
r.tag.as_str()
};
let kind = if r.prerelease { " [pre-release]" } else { "" };
let latest = if i == 0 { " (latest)" } else { "" };
let date = r.published_at.split('T').next().unwrap_or("");
choice.choice_append(&format!("{tag}{kind} {date}{latest}"));
}
choice.choice_set_selection(0);
}
root.add(
choice,
0,
@@ -2777,6 +2817,35 @@ impl App {
);
self.install_release_choice = choice;
// Release repo: any Gitea owner/repo that publishes the same .afw release
// format; defaults to blueflare/alkane-os. Reload re-scans it and keeps
// only the releases compatible with this board.
root.add(
Widget::static_text(dlg, "Release repo (owner/repo), then Reload:"),
0,
sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP,
12,
);
let repo_row = Widget::box_sizer(false);
let repo_input = Widget::text_ctrl(dlg, false);
repo_input.set_value("blueflare/alkane-os");
repo_row.add(repo_input, 1, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_RIGHT, 6);
repo_row.add(
Widget::button(dlg, "Reload", ID_INSTALL_RELOAD),
0,
0,
0,
);
self.install_repo_input = repo_input;
root.add_sizer(
repo_row,
0,
sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT,
12,
);
// Initial population from the default repo.
self.populate_install_releases("blueflare", "alkane-os");
// Or install from a local .afw the operator picks (the CLI's local-file
// install, now in the GUI). When a file is chosen it takes precedence
// over the release selected above; the label shows the current choice.
@@ -5967,6 +6036,7 @@ impl App {
self.restore_dialog.close(0);
}
ID_INSTALL_OK => self.apply_install_confirm(),
ID_INSTALL_RELOAD => self.reload_install_repo(),
ID_INSTALL_BROWSE => {
if let Some(path) =
Widget::file_dialog(self.install_dialog, "Choose a local .afw to install")