Skip to content

Commit 5f1f34a

Browse files
committed
Add one-click local InboxAnchor launcher
1 parent fd2575c commit 5f1f34a

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

scripts/open_inboxanchor.command

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/zsh
2+
3+
set -euo pipefail
4+
5+
BACKEND_URL="http://127.0.0.1:8010/health"
6+
FRONTEND_URL="http://127.0.0.1:8080/login"
7+
FRONTEND_ROOT="/Users/lucaomul/InboxAnchor/frontend"
8+
FRONTEND_LOG="/private/tmp/inboxanchor-frontend.log"
9+
BACKEND_LABEL="gui/$(id -u)/com.luca.inboxanchor.backend"
10+
11+
launchctl kickstart -k "$BACKEND_LABEL" >/dev/null 2>&1 || true
12+
13+
if ! curl -fsS "$FRONTEND_URL" >/dev/null 2>&1; then
14+
(
15+
cd "$FRONTEND_ROOT"
16+
nohup npm run dev >"$FRONTEND_LOG" 2>&1 &
17+
)
18+
fi
19+
20+
for _ in {1..30}; do
21+
if curl -fsS "$BACKEND_URL" >/dev/null 2>&1 && curl -fsS "$FRONTEND_URL" >/dev/null 2>&1; then
22+
break
23+
fi
24+
sleep 1
25+
done
26+
27+
osascript <<'APPLESCRIPT'
28+
tell application "Safari"
29+
activate
30+
open location "http://127.0.0.1:8080/login"
31+
end tell
32+
APPLESCRIPT

0 commit comments

Comments
 (0)