Add LAN dev helper for iPhone against local Mac API (#181)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: cynarAI <cynarAI@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b8781a0081
commit
81468063ff
@ -79,6 +79,19 @@ Desktop:
|
||||
pnpm --filter @rakazo/desktop dev
|
||||
```
|
||||
|
||||
### iPhone on the same Wi‑Fi (Mac LAN)
|
||||
|
||||
The mobile app can talk to a self-hosted API over **HTTP** on your local network. The API must listen on all interfaces, not only loopback.
|
||||
|
||||
```bash
|
||||
# sets API_HOST=0.0.0.0 in .env, prints the URL, starts pnpm dev
|
||||
bash scripts/dev-mobile-lan.sh
|
||||
```
|
||||
|
||||
On the iPhone: open evOo → **Custom server** on sign-in → `http://<mac-lan-ip>:3100` (the script prints the IP). Allow **Local Network** when iOS asks.
|
||||
|
||||
Optional dev client: `pnpm --filter @rakazo/mobile start` and scan the QR code with Expo Go (you still set the custom server URL in the app).
|
||||
|
||||
## 5. Local models / Ollama seed
|
||||
|
||||
```bash
|
||||
|
||||
60
scripts/dev-mobile-lan.sh
Executable file
60
scripts/dev-mobile-lan.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start dev stack with the API reachable from an iPhone on the same LAN.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
if [[ ! -f .env ]]; then
|
||||
echo "Missing .env — run: cp .env.example .env and fill secrets." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set_env_var() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
if grep -q "^${key}=" .env; then
|
||||
perl -pi -e "s/^\\Q${key}=\\E.*/${key}=${value}/" .env
|
||||
else
|
||||
printf '\n%s=%s\n' "$key" "$value" >> .env
|
||||
fi
|
||||
}
|
||||
|
||||
lan_ipv4() {
|
||||
local os ip iface
|
||||
os="$(uname -s)"
|
||||
if [[ "$os" == Darwin ]]; then
|
||||
for iface in en0 en1 bridge100; do
|
||||
ip="$(ipconfig getifaddr "$iface" 2>/dev/null || true)"
|
||||
if [[ -n "$ip" ]]; then
|
||||
echo "$ip"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
fi
|
||||
if command -v ip >/dev/null 2>&1; then
|
||||
ip route get 1.1.1.1 2>/dev/null | awk '{for (i=1;i<=NF;i++) if ($i=="src") { print $(i+1); exit }}'
|
||||
return 0
|
||||
fi
|
||||
hostname -I 2>/dev/null | awk '{print $1}'
|
||||
}
|
||||
|
||||
set_env_var API_HOST "0.0.0.0"
|
||||
|
||||
IP="$(lan_ipv4 || true)"
|
||||
PORT="${API_PORT:-3100}"
|
||||
|
||||
echo ""
|
||||
echo "evOo LAN (iPhone / iPad)"
|
||||
echo " 1. Same Wi‑Fi as this machine; allow incoming TCP ${PORT} in the firewall."
|
||||
echo " 2. In the evOo app: Sign in → Custom server"
|
||||
if [[ -n "$IP" ]]; then
|
||||
echo " 3. Server URL: http://${IP}:${PORT}"
|
||||
else
|
||||
echo " 3. Server URL: http://<this-machine-lan-ip>:${PORT}"
|
||||
echo " (Could not detect LAN IP — check System Settings → Network.)"
|
||||
fi
|
||||
echo ""
|
||||
echo "Starting pnpm dev …"
|
||||
exec pnpm dev
|
||||
Loading…
x
Reference in New Issue
Block a user