Compare commits

...
Author SHA1 Message Date
noahandClaude Opus 5.5 1da1b88201 build-gui-macos: build like CI, without --locked
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 7m24s
verify / verify-windows (pull_request) Successful in 5m10s
A release sets the crate version first, which changes the workspace
entries in Cargo.lock; --locked then refuses to build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:04:55 -06:00
noah d9dc60918c Merge pull request 'macOS build: universal app for Apple Silicon and Intel, macOS 11+' (#23) from macos-build into main
build-test-release / release (push) Successful in 13m52s
build-test-release / windows (push) Successful in 6m2s
2026-11-03 14:41:23 -07:00
noahandClaude Opus 5.5 bb31a7befc macOS build: universal app for Apple Silicon and Intel, macOS 11+
verify / verify (pull_request) Successful in 7m33s
source / check (pull_request) Skipped
verify / verify-windows (pull_request) Successful in 5m48s
- scripts/build-wx-macos.sh: static, monolithic, universal (arm64 +
  x86_64) wxOSX/Cocoa 3.3.3 from the vendored tree, with wx's bundled
  image/zlib/regex/expat so the app links only system frameworks.
  Minimum macOS 11.0: current SDKs' libc++ supports nothing older.
- scripts/build-gui-macos.sh: builds both Rust targets against that
  prefix and merges them with lipo.
- ci/package-macos.py: "Alkane Toolkit.app" (Info.plist, icon, local
  network usage string), ad-hoc signed, zipped with ditto as
  alkane-toolkit-vX.Y.Z-macos-universal.zip with LICENSE and README.
- crates/alkane-gui/macos: app icon (.icns) from the same glyph as the
  Windows icon, plus the script that makes it.
- wx-rs patch 0009: macOS goes through wx-config (drops the universal
  -arch flags, maps -framework), reports logical sizes like GTK/MSW
  instead of narrowing floats to ints, and links clang's compiler
  runtime for wxOSX's @available checks.
- docs/macos.md, README and the manual's install chapter.

Verified on an M1 running macOS 27.0.1: both slices build, all
workspace unit tests pass, and the headless UI self-test passes 52/52
on arm64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:26:56 -06:00
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
22 changed files with 632 additions and 56 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
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
of this software and associated documentation files (the "Software"), to deal
+3 -1
View File
@@ -32,7 +32,9 @@ uses offline fixtures and does not contact hardware.
Windows 10/11 builds are cross-compiled on Linux (`scripts/build-wx-windows.sh`,
then `scripts/build-gui-windows.sh`) and attached to every release as a
self-contained `alkane-toolkit.exe`; see [docs/windows.md](docs/windows.md).
macOS is not built.
macOS builds run on a Mac (`scripts/build-wx-macos.sh`, then
`scripts/build-gui-macos.sh`) and produce one universal app for Apple Silicon
and Intel, macOS 11 or later; see [docs/macos.md](docs/macos.md).
## Current scope
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Package the universal macOS build as an app bundle, for release.
package-macos.py VERSION BINARY OUT_DIR
BINARY is the universal (arm64 + x86_64) alkane-toolkit executable made by
scripts/build-gui-macos.sh. Writes
dist/alkane-toolkit-vVERSION-macos-universal.zip holding "Alkane Toolkit.app",
LICENSE and README.txt, and prints its path. Runs on macOS (lipo, codesign,
ditto).
The bundle is ad-hoc signed only (Apple Silicon refuses to run unsigned
code); it is not signed with a Developer ID or notarized, so Gatekeeper asks
the user to confirm the first launch. README.txt says how.
"""
import pathlib
import plistlib
import shutil
import subprocess
import sys
import tempfile
ROOT = pathlib.Path(__file__).resolve().parents[1]
APP = "Alkane Toolkit.app"
BUNDLE_ID = "re.bluefla.alkane-toolkit"
MIN_MACOS = "11.0"
def run(*args: str) -> str:
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
def build_app(version: str, binary: pathlib.Path, dest: pathlib.Path) -> pathlib.Path:
archs = run("lipo", "-archs", str(binary)).split()
if sorted(archs) != ["arm64", "x86_64"]:
sys.exit(f"{binary} is not a universal arm64 + x86_64 binary: {archs}")
app = dest / APP
macos = app / "Contents" / "MacOS"
resources = app / "Contents" / "Resources"
macos.mkdir(parents=True)
resources.mkdir()
shutil.copy2(binary, macos / "alkane-toolkit")
shutil.copy2(ROOT / "crates/alkane-gui/macos/alkane-toolkit.icns", resources)
info = {
"CFBundleName": "Alkane Toolkit",
"CFBundleDisplayName": "Alkane Toolkit",
"CFBundleIdentifier": BUNDLE_ID,
"CFBundleExecutable": "alkane-toolkit",
"CFBundleIconFile": "alkane-toolkit",
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": version,
"CFBundleVersion": version,
"CFBundleInfoDictionaryVersion": "6.0",
"LSMinimumSystemVersion": MIN_MACOS,
"NSHighResolutionCapable": True,
"NSPrincipalClass": "NSApplication",
# The scanner talks to miners on the local network.
"NSLocalNetworkUsageDescription":
"Alkane Toolkit scans your local network to find and manage miners.",
"NSHumanReadableCopyright":
"Copyright (c) 2026 BlueFlare Energy Solutions Inc. (MIT License)",
}
with open(app / "Contents" / "Info.plist", "wb") as fh:
plistlib.dump(info, fh)
(app / "Contents" / "PkgInfo").write_text("APPL????")
# Ad-hoc signature over the whole bundle (the linker's per-slice
# signatures do not cover Info.plist or the resources).
run("codesign", "--force", "--sign", "-", "--timestamp=none", str(app))
run("codesign", "--verify", "--strict", str(app))
return app
def release(version: str, binary: str, out_dir: str) -> None:
name = f"alkane-toolkit-v{version}-macos-universal"
out = pathlib.Path(out_dir).resolve() / f"{name}.zip"
out.parent.mkdir(parents=True, exist_ok=True)
readme = (
f"alkane-toolkit v{version} (macOS, Apple Silicon and Intel)\n"
"\n"
f"Runs on macOS {MIN_MACOS} (Big Sur) or later. Drag \"Alkane Toolkit\"\n"
"to Applications, then open it.\n"
"\n"
"The app is not notarized by Apple, so the first launch is blocked\n"
"with a warning. To allow it once:\n"
" - macOS 15 or later: try to open it, then System Settings >\n"
" Privacy & Security > \"Open Anyway\" for Alkane Toolkit.\n"
" - macOS 11 to 14: Control-click the app, choose Open, then Open.\n"
"Or, in Terminal: xattr -dr com.apple.quarantine \"/Applications/Alkane Toolkit.app\"\n"
"\n"
"Settings are stored in ~/.config/alkane-toolkit/.\n"
"Manual: https://blueflare.gitea.bluefla.re/alkane-toolkit/manual/\n"
)
with tempfile.TemporaryDirectory(prefix="alkane-macos-") as tmp:
folder = pathlib.Path(tmp) / name
folder.mkdir()
build_app(version, pathlib.Path(binary), folder)
shutil.copy2(ROOT / "LICENSE", folder / "LICENSE")
(folder / "README.txt").write_text(readme)
out.unlink(missing_ok=True)
run("ditto", "-c", "-k", "--keepParent", str(folder), str(out))
print(out)
if __name__ == "__main__":
if len(sys.argv) != 4:
sys.exit(__doc__)
release(*sys.argv[1:])
+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"
"\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"
if signed else
"This build is not code-signed, so Windows SmartScreen may warn on first\r\n"
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
# Regenerate alkane-toolkit.icns (the macOS app icon) from the in-repo
# microchip glyph: the same white chip on a rounded amber tile as the Windows
# icon, at the sizes macOS asks for (16-1024 px). Needs rsvg-convert,
# ImageMagick and python3; the .icns is committed, so a build never runs this.
set -e
cd "$(dirname "$0")"
GLYPH=../assets/icons/microchip-solid-full.svg
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' 0
sed 's/currentColor/#ffffff/g; s/<svg /<svg fill="#ffffff" /' "$GLYPH" > "$TMP/glyph.svg"
for s in 16 32 64 128 256 512 1024; do
# Apple's grid: the tile fills ~80% of the canvas, centred.
t=$((s * 80 / 100)); m=$(((s - t) / 2)); r=$((t * 22 / 100))
g=$((t * 60 / 100)); o=$(((s - g) / 2))
rsvg-convert -w "$g" -h "$g" "$TMP/glyph.svg" -o "$TMP/g$s.png"
convert -size "${s}x${s}" xc:none -fill '#d9822b' \
-draw "roundrectangle $m,$m $((m + t - 1)),$((m + t - 1)) $r,$r" \
"$TMP/g$s.png" -geometry "+$o+$o" -composite "PNG32:$TMP/i$s.png"
done
python3 - "$TMP" alkane-toolkit.icns <<'PY'
import pathlib, struct, sys
tmp, out = pathlib.Path(sys.argv[1]), sys.argv[2]
# ICNS element types that hold PNG data, by pixel size.
types = [("icp4", 16), ("icp5", 32), ("icp6", 64), ("ic07", 128), ("ic08", 256),
("ic09", 512), ("ic10", 1024), ("ic11", 32), ("ic12", 64), ("ic13", 256),
("ic14", 512)]
body = b""
for kind, size in types:
data = (tmp / f"i{size}.png").read_bytes()
body += kind.encode() + struct.pack(">I", len(data) + 8) + data
pathlib.Path(out).write_bytes(b"icns" + struct.pack(">I", len(body) + 8) + body)
PY
echo "wrote $(pwd)/alkane-toolkit.icns"
+38 -3
View File
@@ -69,13 +69,26 @@ pub fn load_ssh_credentials() -> Option<(String, String)> {
load_creds_file(SSH_CREDENTIALS_FILE)
}
/// Save the SSH username/password (0600). Retained for a future SSH-login dialog
/// now that the SSH PIC probe that used to save it has been removed (round 14 #5).
#[allow(dead_code)]
/// Save the SSH username/password (0600), from the Credentials dialog.
pub fn save_ssh_credentials(user: &str, pass: &str) -> std::io::Result<()> {
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.
pub fn clear_credentials() -> std::io::Result<()> {
match clear_creds_file(CREDENTIALS_FILE) {
@@ -272,6 +285,28 @@ mod tests {
assert_eq!(load_credentials(), None, "cleared -> None");
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
// HOME is process-global: a second #[test] mutating it would race under
// 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() {
return (
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}");
+10 -1
View File
@@ -86,7 +86,9 @@ pub fn save_scan_concurrency(n: usize) -> std::io::Result<()> {
.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.
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]
fn cidr_aggregation_round_trips() {
// 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.
creds_user_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
// (firmware name, user field, pass field) row per registry firmware.
fwcreds_dialog: Widget,
@@ -1138,6 +1140,8 @@ pub fn build(frame: Widget) -> App {
header_menu_col: None,
creds_user_input: frame,
creds_pass_input: frame,
ssh_user_input: frame,
ssh_pass_input: frame,
fwcreds_dialog: frame,
fwcreds_rows: Vec::new(),
access_probe: None,
@@ -2355,6 +2359,7 @@ impl App {
vnish_pass
};
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();
self.restore_dialog.close(1);
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_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.
let head = Widget::box_sizer(false);
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}"));
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.
let mut map: std::collections::HashMap<String, (String, String)> =
std::collections::HashMap::new();
@@ -3259,6 +3325,8 @@ impl App {
fn apply_firmware_creds_reset(&mut self) {
self.creds_user_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 {
let (user, pass) = credentials::firmware_default_for(name);
user_ctrl.set_value(&user);
@@ -3266,7 +3334,8 @@ impl App {
}
let per_fw = credentials::clear_firmware_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"),
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);
edit.set_value(&scan::load_ranges().join("\n"));
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);
// Auto-rescan interval (seconds; 0 = off) and per-miner scan timeout.
+2 -2
View File
@@ -25,11 +25,11 @@ BEGIN
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "Blueflare"
VALUE "CompanyName", "BlueFlare Energy Solutions Inc."
VALUE "FileDescription", "Alkane Toolkit"
VALUE "FileVersion", ALKANE_VER_STR
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 "ProductName", "Alkane Toolkit"
VALUE "ProductVersion", ALKANE_VER_STR
+62
View File
@@ -0,0 +1,62 @@
# macOS
The macOS build is one universal app, `Alkane Toolkit.app`, that runs natively
on Apple Silicon and Intel Macs with macOS 11 (Big Sur) or later. It ships as
`alkane-toolkit-vX.Y.Z-macos-universal.zip`, holding the app, `LICENSE` and a
`README.txt`.
## Using it
- Settings live in `~/.config/alkane-toolkit`, the same files as on Linux.
- SSH actions use the system `ssh`; HTTP actions use the system `curl`.
- The app is ad-hoc signed but not notarized, so macOS blocks the first launch.
On macOS 15 or later, try to open it, then choose **Open Anyway** in
System Settings > Privacy & Security. On macOS 11 to 14, Control-click the
app and choose **Open**. Or clear the quarantine flag once:
`xattr -dr com.apple.quarantine "/Applications/Alkane Toolkit.app"`.
- The first scan asks for permission to find devices on the local network
(macOS 15 and later). Scanning needs it.
- Offline demo: `ALKANE_FAKE_SCAN=1 "/Applications/Alkane Toolkit.app/Contents/MacOS/alkane-toolkit"`.
## Building
macOS builds only on a Mac. It needs the Xcode Command Line Tools
(`xcode-select --install`) and rustup with both Apple targets:
```sh
rustup target add aarch64-apple-darwin x86_64-apple-darwin
scripts/build-wx-macos.sh # once: universal static wxOSX 3.3.3 in ~/.cache/wx-3.3.3-macos
scripts/build-gui-macos.sh # both slices, merged with lipo
python3 ci/package-macos.py X.Y.Z target/universal-apple-darwin/release/alkane-toolkit dist
```
`build-wx-macos.sh` builds wxWidgets once for arm64 and x86_64 together, with
wx's bundled image, zlib, regex and expat libraries, so the app links only
against system frameworks. `build-gui-macos.sh` builds each Rust target
against that prefix and merges them. `package-macos.py` writes the bundle
(Info.plist, icon), ad-hoc signs it and zips it with `ditto`.
To test on the Mac:
```sh
ALKANE_SELFTEST=1 target/universal-apple-darwin/release/alkane-toolkit # headless UI self-test
cargo test --release --offline --target aarch64-apple-darwin --workspace --exclude wx-rs
```
The self-test opens a window briefly, so it needs a logged-in desktop
session. Running the x86_64 slice on Apple Silicon needs Rosetta 2.
## Why macOS 11
Current Xcode SDKs ship a libc++ that supports macOS 11 and later only;
building for an older target compiles, but the app could fail at run time on
the older system. macOS 11 is also the first release for Apple Silicon. Older
Intel Macs would need a build with an older SDK.
## Notes for the bridge
wxOSX reports logical (point) sizes, like the GTK and MSW bridges; the
bridge never scales to physical pixels. wxOSX's Objective-C uses
`@available`, so `build.rs` links clang's compiler runtime
(`libclang_rt.osx.a`), which rustc's link does not include by itself. Both
are wx-rs patch `0009`.
+13 -2
View File
@@ -14,6 +14,7 @@ Get the latest release from the
|---|---|---|
| Windows 10 and 11 (x86_64) | `alkane-toolkit-vX.Y.Z-windows-x86_64.zip` | One signed `alkane-toolkit.exe`; nothing to install |
| Linux (x86_64) | `alkane-toolkit-vX.Y.Z-linux-x86_64.tar.gz` | One binary; needs GTK 3 (`sudo apt install libgtk-3-0`) |
| macOS 11 or later (Apple Silicon and Intel) | `alkane-toolkit-vX.Y.Z-macos-universal.zip` | One app; not notarized, so confirm the first launch |
### Windows
@@ -23,6 +24,16 @@ Get the latest release from the
the verified publisher. To check the signature yourself, right-click the exe,
choose **Properties** and open **Digital Signatures**.
### macOS
1. Download the zip and open it; drag **Alkane Toolkit** to Applications.
2. Open it. The app is not notarized, so macOS blocks the first launch:
- macOS 15 or later: open **System Settings > Privacy & Security** and
choose **Open Anyway** for Alkane Toolkit.
- macOS 11 to 14: Control-click the app, choose **Open**, then **Open**.
3. When asked, allow it to find devices on your local network. Scanning
needs this.
### Linux
```sh
@@ -33,8 +44,8 @@ tar xzf alkane-toolkit-vX.Y.Z-linux-x86_64.tar.gz
## First run
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
built-in default range.
**Scan ranges** (see [Scanning](02-scanning.md)); until you do, it scans
192.168.1.0/24, the usual router subnet.
To look around without touching any miner, start it in demo mode. It shows a
built-in sample fleet and simulates every action:
+9 -6
View File
@@ -5,11 +5,13 @@
## Credentials
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.
The saved password is never shown; leave the field blank to keep it. Blank
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.
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 |
| 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
user account (Linux file mode 0600; on Windows, your profile folder's
@@ -40,9 +43,9 @@ permissions).
### SSH login
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:
create `ssh-credentials.txt` in the settings folder with the username on the
first line and the password on the second.
client (built into Windows 10/11). Set its login in the **SSH (restore)** row
of the Credentials dialog. The username defaults to `root`. As with the global
login, the saved password is never shown and a blank password keeps it.
## 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 |
| `scan-credentials.txt` | global login |
| `firmware-credentials.txt` | per-firmware logins |
| `ssh-credentials.txt` | SSH login (created by hand) |
| `ssh-credentials.txt` | SSH login |
| `presets.json` | saved views |
| `language.txt` | UI language |
| `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` |
| 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
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
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 |
|-------|-------|
+25 -6
View File
@@ -1,9 +1,28 @@
#!/bin/sh
# Build the alkane-toolkit GUI on macOS.
# wx-rs upstream supports macOS: its build.rs clones/builds wx 3.2.2.1 into
# ./dist (osx-release-build) on first build. Requires Xcode Command Line
# Tools. Run this ON a Mac - macOS cannot be linked from Linux.
# Build the alkane-toolkit GUI on macOS as one universal binary.
#
# scripts/build-gui-macos.sh [extra cargo build args]
# -> target/universal-apple-darwin/release/alkane-toolkit (arm64 + x86_64)
#
# Needs the Xcode Command Line Tools, rustup with the aarch64-apple-darwin and
# x86_64-apple-darwin targets, and the universal static wx prefix from
# scripts/build-wx-macos.sh (WX_MACOS_PREFIX, default ~/.cache/wx-3.3.3-macos).
# Each target is built separately against that prefix, then the two slices
# are merged with lipo. MACOSX_DEPLOYMENT_TARGET matches the wx build.
set -e
cd "$(dirname -- "$0")/.."
cargo build --release -p alkane-gui
echo "binary: target/release/alkane-toolkit (app bundle packaging is follow-up)"
PREFIX="${WX_MACOS_PREFIX:-$HOME/.cache/wx-3.3.3-macos}"
[ -x "$PREFIX/bin/wx-config" ] || {
echo "no wx prefix at $PREFIX; run scripts/build-wx-macos.sh first" >&2; exit 1; }
export WX_RS_WXCONFIG="$PREFIX/bin/wx-config"
export MACOSX_DEPLOYMENT_TARGET="${MACOSX_MIN:-11.0}"
for target in aarch64-apple-darwin x86_64-apple-darwin; do
cargo build --release --offline -p alkane-gui --target "$target" "$@"
done
out=target/universal-apple-darwin/release
mkdir -p "$out"
lipo -create -output "$out/alkane-toolkit" \
target/aarch64-apple-darwin/release/alkane-toolkit \
target/x86_64-apple-darwin/release/alkane-toolkit
lipo -info "$out/alkane-toolkit"
echo "binary: $out/alkane-toolkit"
+43
View File
@@ -0,0 +1,43 @@
#!/bin/sh
# Build the vendored wxWidgets 3.3.3 for macOS: wxOSX/Cocoa, static,
# monolithic, and universal (arm64 + x86_64) so one prefix serves both Rust
# targets. Run on a Mac with the Xcode Command Line Tools.
#
# scripts/build-wx-macos.sh -> ~/.cache/wx-3.3.3-macos
#
# Dependency tracking is off: its bootstrap fails with several -arch flags.
# MACOSX_MIN (default 11.0) is the oldest macOS the app runs on, for both
# slices: the libc++ in current SDKs supports nothing older, and macOS 11 is
# also where Apple Silicon starts. Image/zlib/regex/expat libraries are
# wx's bundled copies, so the app links only against system frameworks.
# The repo's vendor tree stays pristine; the build lives in ~/.cache/wxbuild.
set -e
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
SRC="$REPO/thirdparty/wxwidgets/wxWidgets-3.3.3"
BUILD="$HOME/.cache/wxbuild/wxWidgets-3.3.3-macos"
PREFIX="${WX_MACOS_PREFIX:-$HOME/.cache/wx-3.3.3-macos}"
MACOSX_MIN="${MACOSX_MIN:-11.0}"
JOBS="${JOBS:-$(sysctl -n hw.ncpu)}"
[ -d "$SRC" ] || { echo "thirdparty wxWidgets tree missing: $SRC" >&2; exit 1; }
rm -rf "$BUILD"
mkdir -p "$HOME/.cache/wxbuild"
cp -R "$SRC" "$BUILD"
trap 'rm -rf "$BUILD"' 0
chmod +x "$BUILD/configure" "$BUILD/config.guess" "$BUILD/config.sub" "$BUILD/install-sh" 2>/dev/null || true
mkdir -p "$BUILD/build-macos"
cd "$BUILD/build-macos"
sh ../configure --prefix="$PREFIX" --with-osx_cocoa \
--disable-shared --enable-monolithic \
--enable-universal_binary=arm64,x86_64 \
--with-macosx-version-min="$MACOSX_MIN" \
--disable-dependency-tracking \
--with-libpng=builtin --with-libjpeg=builtin --without-libtiff \
--with-zlib=builtin --with-expat=builtin --with-regex=builtin \
--without-liblzma --without-libcurl \
--with-opengl=no --disable-stc --disable-webview --disable-mediactrl \
--disable-tests
make -j"$JOBS"
make install
lib=$(ls "$PREFIX"/lib/libwx_osx_cocoau-3.3*.a | head -1)
lipo -info "$lib"
echo "installed: $PREFIX ($lib)"
+140
View File
@@ -0,0 +1,140 @@
Subject: [PATCH 0009] macOS: wxOSX through wx-config, logical sizes, clang runtime
--- a/build.rs
+++ b/build.rs
@@ -42,12 +42,12 @@
target_os() == "linux"
}
-// alkane-toolkit patch: Linux (wxGTK) and Windows/GNU (wxMSW built with
-// mingw-w64, natively or cross from Linux) both build against a wx prefix
-// described by its wx-config script, so they share one code path. Upstream's
-// MSVC/nmake and macOS download-and-build paths are left as they were.
+// alkane-toolkit patch: Linux (wxGTK), macOS (wxOSX/Cocoa, universal static
+// build) and Windows/GNU (wxMSW built with mingw-w64, natively or cross from
+// Linux) all build against a wx prefix described by its wx-config script, so
+// they share one code path. Upstream's MSVC/nmake path is left as it was.
fn uses_wx_config() -> bool {
- is_linux() || (is_windows() && !is_msvc())
+ is_linux() || is_osx() || (is_windows() && !is_msvc())
}
fn is_stub() -> bool {
@@ -278,7 +278,14 @@
build.cpp(true)
.file("cpp_src/wxbridge.cpp")
.file("cpp_src/widgets_bridge.cpp");
- for f in cxxflags.split_whitespace() {
+ let mut flags = cxxflags.split_whitespace();
+ while let Some(f) = flags.next() {
+ // A universal wx prefix reports `-arch arm64 -arch x86_64`; cargo builds
+ // one target at a time and cc adds that target's own -arch.
+ if is_osx() && f == "-arch" {
+ flags.next();
+ continue;
+ }
build.flag(f);
}
if is_linux() {
@@ -308,7 +315,53 @@
}
build.compile("wxbridge");
- for flag in libs.split_whitespace() {
+ if is_osx() {
+ // wxOSX's Objective-C uses @available, which calls
+ // ___isPlatformVersionAtLeast from clang's compiler runtime. clang
+ // links that runtime itself, but rustc drives the link without it.
+ let resource_dir = Command::new("clang")
+ .arg("-print-resource-dir")
+ .output()
+ .ok()
+ .filter(|o| o.status.success())
+ .and_then(|o| String::from_utf8(o.stdout).ok())
+ .map(|s| s.trim().to_string())
+ .ok_or("wx-rs: cannot ask clang for its resource directory")?;
+ let rt = Path::new(&resource_dir).join("lib").join("darwin");
+ if !rt.join("libclang_rt.osx.a").exists() {
+ return Err(format!("wx-rs: no libclang_rt.osx.a in {}", rt.display()).into());
+ }
+ println!("cargo:rustc-link-search=native={}", rt.display());
+ println!("cargo:rustc-link-lib=static=clang_rt.osx");
+ }
+
+ let mut lib_flags = libs.split_whitespace();
+ while let Some(flag) = lib_flags.next() {
+ if is_osx() {
+ match flag {
+ "-arch" => {
+ lib_flags.next();
+ continue;
+ }
+ "-framework" => {
+ if let Some(name) = lib_flags.next() {
+ println!("cargo:rustc-link-lib=framework={}", name);
+ }
+ continue;
+ }
+ "-weak_framework" => {
+ if let Some(name) = lib_flags.next() {
+ println!("cargo:rustc-link-arg=-Wl,-weak_framework,{}", name);
+ }
+ continue;
+ }
+ _ if flag.starts_with("-Wl,") => {
+ println!("cargo:rustc-link-arg={}", flag);
+ continue;
+ }
+ _ => {}
+ }
+ }
if flag.ends_with(".a") && Path::new(flag).is_absolute() {
// static wx builds: wx-config emits the archive as a full path
let file = Path::new(flag).file_name().and_then(|f| f.to_str()).unwrap_or(flag);
--- a/cpp_src/wxbridge.cpp
+++ b/cpp_src/wxbridge.cpp
@@ -492,21 +492,12 @@
// The logical window size
Size get_client_size() {
-#ifdef __APPLE__
- int status_bar_height;
- if (wxGetApp().frame->GetStatusBar()) {
- status_bar_height = wxGetApp().frame->GetStatusBar()->GetRect().height;
- } else {
- status_bar_height = 0;
- }
- float scale_factor = wxGetApp().frame->GetDPIScaleFactor();
- wxSize s = wxGetApp().frame->GetClientSize();
- struct Size sz = {s.x * scale_factor, (s.y + status_bar_height) * scale_factor};
- return sz;
-#elif defined(__linux__)
- // alkane-toolkit patch: wxGTK3 path (upstream only knew Apple vs Windows)
+#if defined(__linux__) || defined(__APPLE__)
+ // alkane-toolkit patch: wxGTK3 and wxOSX both report logical (DIP) sizes,
+ // like every other bridge size. Upstream's Apple branch scaled to physical
+ // pixels through a float -> int narrowing current clang rejects.
wxSize s = wxGetApp().frame->GetClientSize();
- return Size {(unsigned int)s.x, (unsigned int)s.y};
+ return Size {s.x, s.y};
#else
HWND hwnd = (HWND) wxGetApp().frame->GetHandle();
RECT rect;
@@ -559,15 +550,10 @@
}
Size get_mouse_position(wxMouseEvent &event) {
-#ifdef __APPLE__
- wxPoint p = event.GetPosition();
- float scale_factor = wxGetApp().frame->GetDPIScaleFactor();
- struct Size s = {p.x * scale_factor, p.y * scale_factor};
- return s;
-#else
+ // alkane-toolkit patch: logical (DIP) coordinates on every platform,
+ // matching get_client_size (upstream scaled them on Apple).
wxPoint p = event.GetPosition();
return Size {p.x, p.y};
-#endif
}
int get_mouse_wheel_rotation(wxMouseEvent &event) {
+1
View File
@@ -27,6 +27,7 @@ later changes go in new patches.
| 0006 | Build: platform from the target, not the host; Windows/GNU via `wx-config` |
| 0007 | `wxbridge.cpp` on wxMSW: no input-swallowing overlay, appearance before the first window, work-area sizing, executable icon, UTF-8 menu fix |
| 0008 | Widget bridge on wxMSW: generic data-view input and tooltips, DIP boundary, anti-aliased shapes, themed selection colours |
| 0009 | macOS: wxOSX (universal static) through `wx-config`, logical sizes on Apple, clang compiler runtime for `@available` |
History: the round 19 health-tooltip fix (GTK tip area converted from
bin-window to widget coordinates) used to be a separate patch on top of an
+60 -7
View File
@@ -42,12 +42,12 @@ fn is_linux() -> bool {
target_os() == "linux"
}
// alkane-toolkit patch: Linux (wxGTK) and Windows/GNU (wxMSW built with
// mingw-w64, natively or cross from Linux) both build against a wx prefix
// described by its wx-config script, so they share one code path. Upstream's
// MSVC/nmake and macOS download-and-build paths are left as they were.
// alkane-toolkit patch: Linux (wxGTK), macOS (wxOSX/Cocoa, universal static
// build) and Windows/GNU (wxMSW built with mingw-w64, natively or cross from
// Linux) all build against a wx prefix described by its wx-config script, so
// they share one code path. Upstream's MSVC/nmake path is left as it was.
fn uses_wx_config() -> bool {
is_linux() || (is_windows() && !is_msvc())
is_linux() || is_osx() || (is_windows() && !is_msvc())
}
fn is_stub() -> bool {
@@ -278,7 +278,14 @@ fn build_with_wx_config() -> Result<(), Box<dyn Error>> {
build.cpp(true)
.file("cpp_src/wxbridge.cpp")
.file("cpp_src/widgets_bridge.cpp");
for f in cxxflags.split_whitespace() {
let mut flags = cxxflags.split_whitespace();
while let Some(f) = flags.next() {
// A universal wx prefix reports `-arch arm64 -arch x86_64`; cargo builds
// one target at a time and cc adds that target's own -arch.
if is_osx() && f == "-arch" {
flags.next();
continue;
}
build.flag(f);
}
if is_linux() {
@@ -308,7 +315,53 @@ fn build_with_wx_config() -> Result<(), Box<dyn Error>> {
}
build.compile("wxbridge");
for flag in libs.split_whitespace() {
if is_osx() {
// wxOSX's Objective-C uses @available, which calls
// ___isPlatformVersionAtLeast from clang's compiler runtime. clang
// links that runtime itself, but rustc drives the link without it.
let resource_dir = Command::new("clang")
.arg("-print-resource-dir")
.output()
.ok()
.filter(|o| o.status.success())
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().to_string())
.ok_or("wx-rs: cannot ask clang for its resource directory")?;
let rt = Path::new(&resource_dir).join("lib").join("darwin");
if !rt.join("libclang_rt.osx.a").exists() {
return Err(format!("wx-rs: no libclang_rt.osx.a in {}", rt.display()).into());
}
println!("cargo:rustc-link-search=native={}", rt.display());
println!("cargo:rustc-link-lib=static=clang_rt.osx");
}
let mut lib_flags = libs.split_whitespace();
while let Some(flag) = lib_flags.next() {
if is_osx() {
match flag {
"-arch" => {
lib_flags.next();
continue;
}
"-framework" => {
if let Some(name) = lib_flags.next() {
println!("cargo:rustc-link-lib=framework={}", name);
}
continue;
}
"-weak_framework" => {
if let Some(name) = lib_flags.next() {
println!("cargo:rustc-link-arg=-Wl,-weak_framework,{}", name);
}
continue;
}
_ if flag.starts_with("-Wl,") => {
println!("cargo:rustc-link-arg={}", flag);
continue;
}
_ => {}
}
}
if flag.ends_with(".a") && Path::new(flag).is_absolute() {
// static wx builds: wx-config emits the archive as a full path
let file = Path::new(flag).file_name().and_then(|f| f.to_str()).unwrap_or(flag);
+7 -21
View File
@@ -492,21 +492,12 @@ extern "C" {
// The logical window size
Size get_client_size() {
#ifdef __APPLE__
int status_bar_height;
if (wxGetApp().frame->GetStatusBar()) {
status_bar_height = wxGetApp().frame->GetStatusBar()->GetRect().height;
} else {
status_bar_height = 0;
}
float scale_factor = wxGetApp().frame->GetDPIScaleFactor();
wxSize s = wxGetApp().frame->GetClientSize();
struct Size sz = {s.x * scale_factor, (s.y + status_bar_height) * scale_factor};
return sz;
#elif defined(__linux__)
// alkane-toolkit patch: wxGTK3 path (upstream only knew Apple vs Windows)
#if defined(__linux__) || defined(__APPLE__)
// alkane-toolkit patch: wxGTK3 and wxOSX both report logical (DIP) sizes,
// like every other bridge size. Upstream's Apple branch scaled to physical
// pixels through a float -> int narrowing current clang rejects.
wxSize s = wxGetApp().frame->GetClientSize();
return Size {(unsigned int)s.x, (unsigned int)s.y};
return Size {s.x, s.y};
#else
HWND hwnd = (HWND) wxGetApp().frame->GetHandle();
RECT rect;
@@ -559,15 +550,10 @@ extern "C" {
}
Size get_mouse_position(wxMouseEvent &event) {
#ifdef __APPLE__
wxPoint p = event.GetPosition();
float scale_factor = wxGetApp().frame->GetDPIScaleFactor();
struct Size s = {p.x * scale_factor, p.y * scale_factor};
return s;
#else
// alkane-toolkit patch: logical (DIP) coordinates on every platform,
// matching get_client_size (upstream scaled them on Apple).
wxPoint p = event.GetPosition();
return Size {p.x, p.y};
#endif
}
int get_mouse_wheel_rotation(wxMouseEvent &event) {