fix(dev): pass --host 0.0.0.0 to astro dev when --mobile, print LAN URL
This commit is contained in:
+8
-6
@@ -205,7 +205,10 @@ 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)")
|
||||
console.print(f" Browser: [cyan]http://localhost:{port}[/cyan]")
|
||||
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()
|
||||
|
||||
_ensure_npm(site)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user