Bind the native server to the LAN so the phone client can reach it

The native install hardcoded -addr 127.0.0.1, so the server was unreachable from
the phone: the emulator worked because it proxies to the host loopback, but a
real device could not connect even though ntfy (bound to 0.0.0.0:8090) worked.

The bind address is now a manifest setting (server_address() in manage.py, with
older manifests still defaulting to loopback) and setup-native.py records it,
defaulting to 0.0.0.0 like the Docker install did and offering
--bind-address 127.0.0.1 for a loopback-only server. An invalid address is
rejected, and setup prints the phone client URL.

Verified: scripts test suite 116 tests OK, and after reinstalling the server
listens on *:8080 and answers {"healthy":true} on 127.0.0.1, 10.0.0.75,
10.0.0.249 and the tailnet address.
This commit is contained in:
2026-10-15 01:57:27 +01:00
parent 9ca775291b
commit 8adc6b8080
5 changed files with 48 additions and 6 deletions
+7
View File
@@ -37,6 +37,13 @@ class ManageNativeTests(unittest.TestCase):
self.assertEqual(manage.ntfy_mode({"ntfy": {"mode": "native"}}), "native")
self.assertEqual(manage.ntfy_health_url({"ntfy_port": 8090}), "http://127.0.0.1:8090/v1/health")
def test_server_address_uses_the_manifest_bind_and_defaults_to_loopback(self):
self.assertEqual(manage.server_address({"server_port": 8080, "bind_address": "0.0.0.0"}), "0.0.0.0:8080")
self.assertEqual(manage.server_address({"server_port": 8080, "bind_address": "10.0.0.75"}), "10.0.0.75:8080")
# A manifest written before the setting existed must stay loopback-only.
self.assertEqual(manage.server_address({"server_port": 8080}), "127.0.0.1:8080")
self.assertEqual(manage.server_address({"server_port": 8080, "bind_address": ""}), "127.0.0.1:8080")
def test_ntfy_start_launches_binary_with_generated_config(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)