From b7a40cd4b2c615bb5223a2869dede02ac20a876c Mon Sep 17 00:00:00 2001 From: "feifei.xu" <307327147@qq.com> Date: Sat, 14 Mar 2026 21:20:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=A0=B9=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=20+=20=E4=BF=AE=E5=A4=8D=20CORS=20=E6=8B=BC=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ app/__init__.py | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea7bbb7..c263806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [0.6.1] - 2026-03-14 + +### Fixed + +- **根路由缺失** - 添加 `/` 路由,返回服务信息和端点列表 +- **CORS 拼写错误** - 修复 `cors_allowed_origins` 拼写 + +--- + ## [0.6.0] - 2026-03-14 ### Fixed diff --git a/app/__init__.py b/app/__init__.py index d5352fa..db62427 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -11,7 +11,7 @@ from app.extensions import ( ) # Socket.IO 实例 - 避免与 app/socketio 目录冲突 -socketio_app = SocketIO(cors_allowed_origions="*", async_mode='threading') +socketio_app = SocketIO(cors_allowed_origins="*", async_mode='threading') def create_app(config_name='default'): @@ -34,6 +34,25 @@ def create_app(config_name='default'): # 注册错误处理 _register_error_handlers(app) + # 根路由 + @app.route('/') + def index(): + return { + 'service': 'PIT Router', + 'version': '0.6.0', + 'status': 'running', + 'endpoints': { + 'health': '/health', + 'auth': '/api/auth', + 'sessions': '/api/sessions', + 'agents': '/api/agents', + 'gateways': '/api/gateways', + 'messages': '/api/messages', + 'stats': '/api/stats', + 'websocket': 'ws://host:9000' + } + } + # 健康检查端点 @app.route('/health') def health_check():