feat: 支持多项目打包
- config.json 改为按项目存储(projects.<id>),上传配置全局共用;旧单项目配置自动迁移为 readoor
- 新增项目管理(管理员):Git 仓库/凭据、源码目录、Xcode 工程、拷贝条目、配置替换方式、自定义字段、替换规则
- 通用配置替换:pbxproj 版本号与签名,patch_rules 支持 define / replace_line 及 ${app.X}、${server.X} 模板
- 请求通过 X-Project 头选择项目;打包任务记录 project_id,历史按项目过滤
- 前端顶部切换项目,App/服务器环境表单按项目显示字段
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2bd5c7057f
commit
8f2f23682f
+14
-1
@@ -12,6 +12,7 @@ from .routers import config, apps, tasks, auth, users, operations
|
||||
from .services.log_streamer import log_streamer
|
||||
from .config import BACKEND_PORT, CORS_ALLOWED_ORIGINS, TRUSTED_HOSTS, validate_production_security
|
||||
from .deps import decode_current_user
|
||||
from .projects import PROJECT_HEADER, current_project_id
|
||||
|
||||
STATIC_DIR = Path(__file__).parent / "static"
|
||||
|
||||
@@ -37,11 +38,23 @@ if CORS_ALLOWED_ORIGINS:
|
||||
allow_origins=CORS_ALLOWED_ORIGINS,
|
||||
allow_credentials=False,
|
||||
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
||||
allow_headers=["Authorization", "Content-Type"],
|
||||
allow_headers=["Authorization", "Content-Type", PROJECT_HEADER],
|
||||
)
|
||||
|
||||
app.add_middleware(TrustedHostMiddleware, allowed_hosts=TRUSTED_HOSTS)
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
async def bind_project(request: Request, call_next):
|
||||
"""按请求头 X-Project(下载链接等无法带请求头时用 ?project=)确定本次请求操作的项目。"""
|
||||
project_id = request.headers.get(PROJECT_HEADER) or request.query_params.get("project") or None
|
||||
token = current_project_id.set(project_id)
|
||||
try:
|
||||
return await call_next(request)
|
||||
finally:
|
||||
current_project_id.reset(token)
|
||||
|
||||
|
||||
# 路由
|
||||
app.include_router(auth.router)
|
||||
app.include_router(users.router)
|
||||
|
||||
Reference in New Issue
Block a user