Skip to content

Refactor: rig bridge readme updates/install scripts refactor#896

Draft
ceotjoe wants to merge 2 commits intoaccius:Stagingfrom
ceotjoe:docs/rig-bridge-readme-updates
Draft

Refactor: rig bridge readme updates/install scripts refactor#896
ceotjoe wants to merge 2 commits intoaccius:Stagingfrom
ceotjoe:docs/rig-bridge-readme-updates

Conversation

@ceotjoe
Copy link
Copy Markdown
Collaborator

@ceotjoe ceotjoe commented Apr 8, 2026

What does this PR do?

Based on feedback in FB there are some flaws regarding the install scripts and documentation. This PR will address that.

Overview

This PR significantly enhances the reliability, cross-platform compatibility, and user experience of the Rig Bridge installation and update logic. The installer scripts across Windows, macOS, and Linux have been structurally refactored to securely handle dynamic configurations, safely flush out stale code bases during updates, and aggressively guarantee users are surfaced with the proper documentation requirements before booting the Setup UI.
Target Branch: staging

Installer Logic Enhancements

  • Dynamic Config Handling: Installer scripts (server/routes/rig-bridge.js) no longer rely on localhost:5555. Everything is now explicitly extracted straight out of the rig-bridge-config.json file. It dynamically loads the port, tls protocols, and custom bindAddress IPs to properly formulate networking connections.
  • Fool-proof Updates: Process shutdown/kills now explicitly target whatever dynamic port is configured rather than blindly striking 5555.
  • Stale File Deletion: Remedied major filesystem logic bugs that left outdated files permanently stranded in local repositories. Directories are now firmly wiped using deeply-recursing cleanup tasks (rmdir /S /Q on Windows and find -mindepth 1 -maxdepth 1 ... -exec rm -rf {} + on Mac/Linux) prior to cloning the updated Git repository.
  • Interactive Browser Halting: Stripped out the primitive methods that raced the browser Setup UI prior to the Node backend launching. Installers now safely run the Rig Bridge Node process in the console background, gracefully await active TCP connection handshakes locally, output a critical interaction warning forcing users to acknowledge reading rig-bridge/README.md, and completely automatically open the browser directly afterwards.

Documentation Updates

  • Updated Steps 4 & 5 within the "Getting Started" segment of rig-bridge/README.md effectively clarifying the new automatic installer UI-prompting behavior.
  • Cleaned up miscellaneous notes surrounding GitHub repository operations and Node requirements.

Related Issues/Files Changed

  • server/routes/rig-bridge.js
  • rig-bridge/README.md

Verification

  • Verified directory extraction (.bat/.sh) behavior locally to confirm parent variables are rigorously structured against expansion/recursion threats.
  • Verified terminal halting behaviour and dynamic browser triggering loops on all three main operating systems.

ceotjoe added 2 commits April 8, 2026 10:05
- Installer scripts generated in `server/routes/rig-bridge.js` now automatically resolve the configured TCP port, TLS scheme, and bindAddress configuration dynamically.
- Refactored both Windows and macOS/Linux installer scripts to halt and interactively request user confirmation after verifying that they read the `README.md` before launching the Setup UI.
- Improved subdirectory flushing using recursive deletions (`rmdir /S` and `find -exec rm -rf`) prior to repo extraction to ensure stale files do not survive updates.
- Refactored Rig Bridge `README.md` text to correctly define the new installation UI behavior.
Copy link
Copy Markdown
Owner

@accius accius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — Rig Bridge installer refactor (draft)

Good direction. The dynamic port/proto/bind-address extraction and the aggressive stale-file cleanup are real improvements. A few things before moving out of draft:

Correctness

  1. No timeout on "wait for listening" loops. If node rig-bridge.js fails to bind (permission, port in use, syntax error in the built JS), the shell loop while ! lsof -ti tcp:$RB_PORT …; do sleep 1; done spins forever, and the Windows :waitloop does the same. Please bound these (e.g. 30 iterations / 30s) and bail with a readable error + tail of node output.

  2. Windows: node is launched with start /b (background, attached to console), so the user sees the "Press Enter" prompt, but there is no capture of the node PID. If node has already died by the time netstat check runs, :waitloop spins forever. Same timeout concern as #1.

  3. Windows :nodeloopport at end polls every 2s while the port is still listening and exits when it stops — but there is no kill path for node on Ctrl-C, and nothing actually waits on node as a process (unlike the POSIX wait $NODE_PID). If the user closes the window the node child may be orphaned. Consider using start /wait or simply node rig-bridge.js in the foreground after the browser opens.

  4. Linux/macOS: open detection after xdg-open is fine, but some minimal Linux distros ship an unrelated open (from util-linux) that will not open a browser. Prefer uname-gated detection: [[ "$(uname)" == "Darwin" ]] && open ….

  5. Three separate PowerShell invocations for port/proto/bind in the .bat — each spawns a process (~500ms). Combine into one ConvertFrom-Json call returning all three values, then parse into env vars.

  6. grep -Eo "[0-9]+$" to recover RB_PORT from SETUP_URL is brittle if the URL ever gains a path. Have the node one-liner print PORT\nURL (two lines) and read both.

  7. Config path fallback: $HOME/.config/openhamclock/rig-bridge-config.json then $HOME/openhamclock-rig-bridge/…. On macOS the canonical path is $HOME/Library/Application Support/openhamclock/… — is that used anywhere? If so, add it to the fallback chain.

  8. bindAddress fallback to localhost is correct for browser-open, but the 0.0.0.0 replacement happens only in the shell variant, not the .bat. Parity bug: Windows still builds http://0.0.0.0:5555 when bindAddress is 0.0.0.0, which does not open in a browser.

Docs

  1. README "e.g., http://localhost:5555" — good. Consider also noting TLS case ("or https://… if you enabled TLS").

  2. Prerequisite block is much clearer than before — nice.

Nits

  1. "ACK" variable set but never read; comment-only prompt. Fine, just note.
  2. The README language ("absolutely vital", "IMPORTANT") is a bit heavy — a single "Before continuing, please read rig-bridge/README.md for radio-specific requirements." is plenty.

Happy to re-review once the timeout/parity fixes land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants