Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

36 lines
772 B
Bash

#!/bin/bash
# Start dino game server and open browser
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PID_FILE="$SCRIPT_DIR/server.pid"
FLAG="$SCRIPT_DIR/.plan-active"
PORT=3456
# Create plan-active flag
touch "$FLAG"
# Check if server is already running
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if kill -0 "$PID" 2>/dev/null; then
# Server running, just open browser
open "http://localhost:$PORT" 2>/dev/null
exit 0
else
rm -f "$PID_FILE"
fi
fi
# Start server in background
nohup node "$SCRIPT_DIR/server.js" > /dev/null 2>&1 &
# Wait for server to be ready
for i in {1..20}; do
if curl -s "http://localhost:$PORT/health" > /dev/null 2>&1; then
break
fi
sleep 0.1
done
# Open browser
open "http://localhost:$PORT" 2>/dev/null