← Commit history

v0.11.4: harden the await:url contract — URL printed to stdout on every path with explicit flush before the webview claim, mirrored to stderr, direct 127.0.0.1 form everywhere including the server's own startup line (cold-verify #4)

John Lauer ·9ac80f9d70 ·1mo ago ·parent 4ba4583
5 files changed +16−4
Cargo.lock+1−1
@@ -4,7 +4,7 @@ version = 4  [[package]] name = "adom-project-manager"-version = "0.11.3"+version = "0.11.4" dependencies = [  "altium-codec",  "anyhow",
Cargo.toml+1−1
@@ -1,6 +1,6 @@ [package] name = "adom-project-manager"-version = "0.11.3"+version = "0.11.4" edition = "2021" description = "Adom Project Manager — the central hub for navigating wiki boards, molecules, and libraries into Hydrogen: browse your wiki boards/projects, view symbol + footprint + 3D and the footprint layer stackup, add components to your KiCad/Altium libraries, and deliver self-contained KiCad projects. Built on adom-lbr." 
bin/adom-project-manager
⋯ 1 unchanged line ⋯
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "adom-project-manager",-  "version": "0.11.3",+  "version": "0.11.4",   "type": "app",   "description": "Adom Project Manager — the central hub for navigating wiki boards, molecules and libraries into Hydrogen: browse your wiki boards/projects (Personal / Organization / Public), view symbol + footprint + 3D and the per-EDA footprint layer stackup, explore the board and schematic in INTERACTIVE cross-probing viewers (click a net, hover a part for stock and price), add components to your KiCad/Altium libraries, and deliver self-contained KiCad projects. Built on adom-lbr. (Formerly Adom Project Manager / adom-project-manager.)",   "dependencies": {
src/main.rs+13−1
@@ -310,10 +310,19 @@ extern "C" { /// webview when the dock told us its tab name. fn finish_serve(port: u16, version: &str, started: bool) {     let url = format!("http://127.0.0.1:{port}/");+    // The URL on stdout IS the dock contract (`await: "url"` scrapes stdout, and+    // the log file is invisible to it). Printed on EVERY path — reuse included,+    // because Hard Refresh Open re-runs the steps and needs the URL each time —+    // and explicitly flushed before the webview claim can block or die.     println!(         "OK: Adom Project Manager v{version} {} on {url}",         if started { "started" } else { "already running" }     );+    let _ = std::io::Write::flush(&mut std::io::stdout());+    // Mirrored to stderr on purpose: if a launcher ever swallows one stream, the+    // other still carries the URL, and a both-streams-empty capture then proves+    // the process never reached this line at all.+    eprintln!("[serve] url {url} (v{version}, {})", if started { "started" } else { "reused" });     if let Ok(name) = std::env::var("ADOM_DOCK_WEBVIEW") {         if !name.is_empty() {             let ok = Command::new("adom-cli")@@ -498,7 +507,10 @@ pub fn run(port: u16) -> Result<()> {     let server = Server::http(format!("{bind}:{port}"))         .map_err(|e| anyhow::anyhow!("bind {bind}:{port}: {e}"))?;     eprintln!("[startup] bound {bind}:{port}, serving");-    println!("OK: Adom Project Manager on http://localhost:{port}");+    // Direct 127.0.0.1 form everywhere a URL is emitted: the dock's networking+    // rule bans the localhost/proxy forms, and this line is scraped when the+    // binary is run directly rather than through `serve`.+    println!("OK: Adom Project Manager on http://127.0.0.1:{port}/");     println!("Hint: open it in a browser, or `adom-desktop desktop_open_url {{\"url\":\"http://localhost:{port}\"}}`.");     println!("Hint: the component list is fetched from {WIKI}; click a row to open the viewer.");     // Handle each request on its own thread. Many endpoints block on the desktop