diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-04 16:08:06 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-04 16:08:06 +0200 |
| commit | a4aabd1d33770d6199a8cb7bc87f639668617bc9 (patch) | |
| tree | f1c280790ae4791b587c879b2922567a44290a54 /packages/meshbay-node/tests/test_packaging_win.py | |
| parent | 7ff675fdc0866ca40bdb703bc95c0cc60e3edd87 (diff) | |
| download | meshbay-a4aabd1d33770d6199a8cb7bc87f639668617bc9.tar.gz | |
fix(packaging): re-running setup no longer re-prompts for firewall access
Every run of customInstall showed the "Allow MeshBay through Windows
Firewall?" question and, on Yes, a fresh UAC prompt -- an upgrade or repair
install would ask again even with all four rules already in place.
customInstall now checks first: firewall.ps1 check, unelevated
(Get-NetFirewallRule needs no admin, only New/Remove do), exits 0 if every
rule already exists. Only a nonzero result reaches the MessageBox and the
elevated add. A second run of setup on an already-configured machine now
asks nothing.
Verified unelevated: check exits 1 and logs which rules are missing on a
machine with none of them (the fresh-install case); electron-builder
compiles the nsExec::Exec / Pop $0 / ${If} wiring. Node suite 837 pass /
25 skip.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_packaging_win.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_packaging_win.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_packaging_win.py b/packages/meshbay-node/tests/test_packaging_win.py index ba3568c..20a2505 100644 --- a/packages/meshbay-node/tests/test_packaging_win.py +++ b/packages/meshbay-node/tests/test_packaging_win.py @@ -199,6 +199,24 @@ def test_the_installer_offers_one_elevated_firewall_step_instead_of_two_dialogs( assert 'firewall.ps1" add' in install +def test_reinstalling_with_the_rules_already_in_place_asks_nothing(): + """ + Get-NetFirewallRule needs no admin, only New/Remove do — so customInstall + checks first, unelevated, and only reaches the MessageBox (and therefore + the UAC prompt) when something is actually missing. Without this, running + setup a second time — an upgrade, a repair install — would re-ask the + question and re-trigger UAC even though nothing needs to change. + """ + nsh = NSH.read_text(encoding="utf-8") + install = _macro_body(nsh, "customInstall") + + check_line = 'firewall.ps1" check' + assert check_line in install + # The check must run, and be evaluated, before the MessageBox — not after. + assert install.index(check_line) < install.index("MessageBox MB_YESNO") + assert "Pop $0" in install and "${If} $0 != 0" in install + + def test_the_uninstaller_offers_to_remove_the_firewall_rules_default_no(): """Opt-in on the way out too, and defaulting to No: a stale allow-rule for a deleted exe is inert, so this should not nag.""" |