fix: replace localhost with 127.0.0.1 and auto-detect server IP

- Install script now auto-detects server IP for remote deployments
- Changed all localhost:3000 references to 127.0.0.1:3000 for local access
- Updated README (EN/ZH) and frontend translations
This commit is contained in:
tinkle-community
2025-12-14 22:30:06 +08:00
parent 1785184481
commit da1d905a31
4 changed files with 36 additions and 15 deletions
+5 -5
View File
@@ -121,7 +121,7 @@ Join our Telegram developer community: **[NOFX Developer Community](https://t.me
curl -fsSL https://raw.githubusercontent.com/NoFxAiOS/nofx/main/install.sh | bash
```
That's it! Open **http://localhost:3000** in your browser.
That's it! Open **http://127.0.0.1:3000** in your browser.
### Docker Compose (Manual)
@@ -131,7 +131,7 @@ curl -O https://raw.githubusercontent.com/NoFxAiOS/nofx/main/docker-compose.prod
docker compose -f docker-compose.prod.yml up -d
```
Access Web Interface: **http://localhost:3000**
Access Web Interface: **http://127.0.0.1:3000**
```bash
# Management commands
@@ -182,7 +182,7 @@ cd web
npm run dev
```
Access Web Interface: **http://localhost:3000**
Access Web Interface: **http://127.0.0.1:3000**
---
@@ -202,7 +202,7 @@ Access Web Interface: **http://localhost:3000**
docker compose -f docker-compose.prod.yml up -d
```
3. **Access**: Open **http://localhost:3000** in your browser
3. **Access**: Open **http://127.0.0.1:3000** in your browser
### Method 2: WSL2 (For Development)
@@ -252,7 +252,7 @@ Access Web Interface: **http://localhost:3000**
cd web && npm install && npm run dev
```
5. **Access**: Open **http://localhost:3000** in Windows browser
5. **Access**: Open **http://127.0.0.1:3000** in Windows browser
### Method 3: Docker in WSL2 (Best of Both Worlds)
+5 -5
View File
@@ -104,7 +104,7 @@
curl -fsSL https://raw.githubusercontent.com/NoFxAiOS/nofx/main/install.sh | bash
```
完成!打开浏览器访问 **http://localhost:3000**
完成!打开浏览器访问 **http://127.0.0.1:3000**
### Docker Compose (手动)
@@ -114,7 +114,7 @@ curl -O https://raw.githubusercontent.com/NoFxAiOS/nofx/main/docker-compose.prod
docker compose -f docker-compose.prod.yml up -d
```
访问 Web 界面: **http://localhost:3000**
访问 Web 界面: **http://127.0.0.1:3000**
```bash
# 管理命令
@@ -165,7 +165,7 @@ cd web
npm run dev
```
访问 Web 界面: **http://localhost:3000**
访问 Web 界面: **http://127.0.0.1:3000**
---
@@ -185,7 +185,7 @@ npm run dev
docker compose -f docker-compose.prod.yml up -d
```
3. **访问**:在浏览器打开 **http://localhost:3000**
3. **访问**:在浏览器打开 **http://127.0.0.1:3000**
### 方法二:WSL2(适合开发)
@@ -235,7 +235,7 @@ npm run dev
cd web && npm install && npm run dev
```
5. **访问**:在 Windows 浏览器打开 **http://localhost:3000**
5. **访问**:在 Windows 浏览器打开 **http://127.0.0.1:3000**
### 方法三:WSL2 + Docker(两全其美)
+24 -3
View File
@@ -157,15 +157,34 @@ wait_for_services() {
fi
}
# Get server IP for display
get_server_ip() {
# Try to get public IP first
local public_ip=$(curl -s --max-time 3 ifconfig.me 2>/dev/null || curl -s --max-time 3 icanhazip.com 2>/dev/null || echo "")
# If no public IP, try local IP
if [ -z "$public_ip" ]; then
if command -v ip &> /dev/null; then
public_ip=$(ip route get 1 2>/dev/null | awk '{print $7}' | head -1)
elif command -v hostname &> /dev/null; then
public_ip=$(hostname -I 2>/dev/null | awk '{print $1}')
fi
fi
echo "${public_ip:-127.0.0.1}"
}
# Print success message
print_success() {
local SERVER_IP=$(get_server_ip)
echo ""
echo -e "${GREEN}╔════════════════════════════════════════════════════════════╗"
echo -e "║ 🎉 Installation Complete! 🎉 ║"
echo -e "╚════════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e " ${BLUE}Web Interface:${NC} http://localhost:3000"
echo -e " ${BLUE}API Endpoint:${NC} http://localhost:8080"
echo -e " ${BLUE}Web Interface:${NC} http://${SERVER_IP}:3000"
echo -e " ${BLUE}API Endpoint:${NC} http://${SERVER_IP}:8080"
echo -e " ${BLUE}Install Dir:${NC} $INSTALL_DIR"
echo ""
echo -e "${YELLOW}Quick Commands:${NC}"
@@ -176,12 +195,14 @@ print_success() {
echo " $COMPOSE_CMD pull && $COMPOSE_CMD up -d # Update to latest"
echo ""
echo -e "${YELLOW}Next Steps:${NC}"
echo " 1. Open http://localhost:3000 in your browser"
echo " 1. Open http://${SERVER_IP}:3000 in your browser"
echo " 2. Configure AI Models (DeepSeek, OpenAI, etc.)"
echo " 3. Configure Exchanges (Binance, Hyperliquid, etc.)"
echo " 4. Create a Strategy in Strategy Studio"
echo " 5. Create a Trader and start trading!"
echo ""
echo -e "${YELLOW}Note:${NC} If accessing from local machine, use http://127.0.0.1:3000"
echo ""
echo -e "${RED}⚠️ Risk Warning: AI trading carries significant risks.${NC}"
echo -e "${RED} Only use funds you can afford to lose!${NC}"
echo ""
+2 -2
View File
@@ -730,7 +730,7 @@ export const translations = {
fullControlDesc: 'Complete control over AI prompts and funds',
startupMessages1: 'Starting automated trading system...',
startupMessages2: 'API server started on port 8080',
startupMessages3: 'Web console http://localhost:3000',
startupMessages3: 'Web console http://127.0.0.1:3000',
// How It Works Section
howToStart: 'How to Get Started with NOFX',
@@ -1770,7 +1770,7 @@ export const translations = {
fullControlDesc: '完全掌控 AI 提示词和资金',
startupMessages1: '启动自动交易系统...',
startupMessages2: 'API服务器启动在端口 8080',
startupMessages3: 'Web 控制台 http://localhost:3000',
startupMessages3: 'Web 控制台 http://127.0.0.1:3000',
// How It Works Section
howToStart: '如何开始使用 NOFX',