Apps reach every service through Maestro on one port; direct service addressing is no longer a supported deployment, and Maestro has no per-service hostname or host-port route. Replace the maestro/direct modes and the serviceRef lookup with one configured origin and the fixed paths /api/alarm/{action,auth,ws}, defaulting dev builds to 127.0.0.1:8080 through adb reverse. The old mode-specific body wrapping and the direct-mode socket branch go with it.
26 lines
1.1 KiB
Bash
Executable File
26 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Dev launcher for the Alarm client.
|
|
#
|
|
# Expects metro already running on 127.0.0.1:8089 (start it with `bun start`
|
|
# in another terminal). Reverses the adb tunnels so the device reaches the
|
|
# dev machine via 127.0.0.1, then builds, installs and launches the app:
|
|
# - 8080 the instance/Maestro origin (dev default; every service path lives
|
|
# under it — the client never opens the service's own 8088)
|
|
# - 8089 the Metro packager (this client's port)
|
|
# Each reverse maps device 127.0.0.1:<port> -> host 127.0.0.1:<port>.
|
|
#
|
|
# The instance address is the one thing the app configures (Settings). Leave it
|
|
# at the default http://127.0.0.1:8080 for a USB phone with these reverses, or
|
|
# point it at a LAN/WAN origin; there is no direct-service mode to toggle.
|
|
set -euo pipefail
|
|
|
|
for port in 8080 8089; do
|
|
adb reverse tcp:"$port" tcp:"$port" >/dev/null 2>&1 || true
|
|
done
|
|
|
|
if ! curl -sf http://127.0.0.1:8089/status >/dev/null 2>&1; then
|
|
echo "WARNING: metro is not running on :8089. Start it first with: bun start"
|
|
fi
|
|
|
|
exec bunx react-native run-android --port 8089 --no-packager
|