fix(dev): pass --host 0.0.0.0 to astro dev when --mobile, print LAN URL

This commit is contained in:
Davide Scaini
2026-05-01 22:20:19 +02:00
parent 12ef5100ef
commit e0b5a55ccc
+7 -5
View File
@@ -205,6 +205,9 @@ def dev(
console.print(f" Mobile: [bold cyan]{mobile_url}[/bold cyan] ← set this as instance URL in the app")
else:
console.print(f" Auth: [yellow]none[/yellow] (single-user, no instance.db)")
if api_host == "0.0.0.0":
console.print(f" Browser: [bold cyan]http://{lan_ip}:{port}[/bold cyan] ← open this on mobile")
else:
console.print(f" Browser: [cyan]http://localhost:{port}[/cyan]")
console.print()
@@ -255,10 +258,9 @@ def dev(
console.print(f"Starting [cyan]astro dev[/cyan] on port {port}")
console.print()
try:
subprocess.run(
["npm", "run", "dev", "--", "--port", str(port)],
cwd=site,
env=env,
)
astro_cmd = ["npm", "run", "dev", "--", "--port", str(port)]
if api_host == "0.0.0.0":
astro_cmd += ["--host", "0.0.0.0"]
subprocess.run(astro_cmd, cwd=site, env=env)
except KeyboardInterrupt:
pass