fix: 更换后端端口 9949 -> 18080 解决 Windows 绑定权限问题
- 修改后端默认端口为 18080 - 更新前端 API 配置支持新端口 - 更新启动/停止脚本端口配置 - 添加 .env 配置文件
This commit is contained in:
@@ -2,7 +2,7 @@ import axios from 'axios'
|
||||
import { showError } from '../utils/message'
|
||||
|
||||
/** @type {string} 默认 API 基础 URL */
|
||||
export const DEFAULT_API_BASE_URL = 'http://localhost:9949'
|
||||
export const DEFAULT_API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:18080'
|
||||
|
||||
/** @type {number} 请求超时时间(毫秒) */
|
||||
export const REQUEST_TIMEOUT = 30000
|
||||
|
||||
@@ -15,7 +15,7 @@ class Settings(BaseSettings):
|
||||
db_path: str = "db/proxies.sqlite"
|
||||
|
||||
# API 服务配置
|
||||
host: str = "0.0.0.0"
|
||||
host: str = "127.0.0.1"
|
||||
port: int = 9949
|
||||
|
||||
# 验证器配置
|
||||
|
||||
@@ -4,7 +4,7 @@ echo === ProxyPool Startup ===
|
||||
echo.
|
||||
|
||||
set "ROOT_PATH=%~dp0.."
|
||||
set "BACKEND_PORT=9949"
|
||||
set "BACKEND_PORT=18080"
|
||||
set "FRONTEND_PORT=9948"
|
||||
|
||||
REM 1. Clean processes on ports
|
||||
@@ -53,7 +53,7 @@ ping -n 3 127.0.0.1 >nul 2>&1
|
||||
set /a RETRY_COUNT+=1
|
||||
|
||||
REM Try to connect to backend health endpoint
|
||||
powershell -Command "try { $r = Invoke-RestMethod -Uri 'http://127.0.0.1:9949/health' -TimeoutSec 2 -ErrorAction Stop; exit 0 } catch { exit 1 }" >nul 2>&1
|
||||
powershell -Command "try { $r = Invoke-RestMethod -Uri 'http://127.0.0.1:18080/health' -TimeoutSec 2 -ErrorAction Stop; exit 0 } catch { exit 1 }" >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
set BACKEND_READY=1
|
||||
goto WAIT_DONE
|
||||
@@ -81,7 +81,7 @@ echo Frontend started
|
||||
echo.
|
||||
|
||||
echo === All services started ===
|
||||
echo Backend: http://127.0.0.1:9949
|
||||
echo Backend: http://127.0.0.1:18080
|
||||
echo Frontend: http://localhost:9948
|
||||
echo.
|
||||
echo Press any key to close this window (services will keep running).
|
||||
|
||||
@@ -3,7 +3,7 @@ chcp 65001 >nul
|
||||
echo === Stopping ProxyPool Services ===
|
||||
echo.
|
||||
|
||||
set "BACKEND_PORT=9949"
|
||||
set "BACKEND_PORT=18080"
|
||||
set "FRONTEND_PORT=9948"
|
||||
set "STOPPED_COUNT=0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user