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")
|
console.print(f" Mobile: [bold cyan]{mobile_url}[/bold cyan] ← set this as instance URL in the app")
|
||||||
else:
|
else:
|
||||||
console.print(f" Auth: [yellow]none[/yellow] (single-user, no instance.db)")
|
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()
|
console.print()
|
||||||
|
|
||||||
_ensure_npm(site)
|
_ensure_npm(site)
|
||||||
@@ -255,10 +258,9 @@ def dev(
|
|||||||
console.print(f"Starting [cyan]astro dev[/cyan] on port {port}…")
|
console.print(f"Starting [cyan]astro dev[/cyan] on port {port}…")
|
||||||
console.print()
|
console.print()
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
astro_cmd = ["npm", "run", "dev", "--", "--port", str(port)]
|
||||||
["npm", "run", "dev", "--", "--port", str(port)],
|
if api_host == "0.0.0.0":
|
||||||
cwd=site,
|
astro_cmd += ["--host", "0.0.0.0"]
|
||||||
env=env,
|
subprocess.run(astro_cmd, cwd=site, env=env)
|
||||||
)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user