diff --git a/README.md b/README.md index c059158..4e57393 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ 🗂️ 项目管理

项目管理
-GitHub/GitLab 导入,多项目协同管理 +GitHub/GitLab/Gitea 导入,多项目协同管理 @@ -190,10 +190,22 @@ docker compose up -d - PostgreSQL 14+ - Docker (用于沙箱) -### 1. 后端启动 + +### 1. 手动启动数据库 + +```bash +docker compose up -d redis db +``` + +### 2. 后端启动 + + ```bash cd backend +# 配置环境 +cp env.example .env + # 激活虚拟环境 (推荐 uv/poetry) source .venv/bin/activate @@ -204,15 +216,18 @@ pip install -r requirements.txt uvicorn app.main:app --reload ``` -### 2. 前端启动 +### 3. 前端启动 ```bash cd frontend +# 配置环境 +cp .env.example .env + npm install npm run dev ``` -### 3. 沙箱环境 +### 4. 沙箱环境 开发模式下,仍需通过 Docker 启动沙箱服务。 ```bash @@ -304,7 +319,7 @@ DeepSeek-Coder · Codestral
| 🤖 **Agent 深度审计** | Multi-Agent 协作,自主编排审计策略 | Agent | | 🧠 **RAG 知识增强** | 代码语义理解,CWE/CVE 知识库检索 | Agent | | 🔒 **沙箱 PoC 验证** | Docker 隔离执行,验证漏洞有效性 | Agent | -| 🗂️ **项目管理** | GitHub/GitLab 导入,ZIP 上传,10+ 语言支持 | 通用 | +| 🗂️ **项目管理** | GitHub/GitLab/Gitea 导入,ZIP 上传,10+ 语言支持 | 通用 | | ⚡ **即时分析** | 代码片段秒级分析,粘贴即用 | 通用 | | 🔍 **五维检测** | Bug · 安全 · 性能 · 风格 · 可维护性 | 通用 | | 💡 **What-Why-How** | 精准定位 + 原因解释 + 修复建议 | 通用 | diff --git a/backend/app/api/v1/endpoints/projects.py b/backend/app/api/v1/endpoints/projects.py index 8d31c68..7ccf648 100644 --- a/backend/app/api/v1/endpoints/projects.py +++ b/backend/app/api/v1/endpoints/projects.py @@ -18,7 +18,7 @@ from app.models.user import User from app.models.audit import AuditTask, AuditIssue from app.models.user_config import UserConfig import zipfile -from app.services.scanner import scan_repo_task, get_github_files, get_gitlab_files, get_github_branches, get_gitlab_branches, should_exclude, is_text_file +from app.services.scanner import scan_repo_task, get_github_files, get_gitlab_files, get_github_branches, get_gitlab_branches, get_gitea_branches, should_exclude, is_text_file from app.services.zip_storage import ( save_project_zip, load_project_zip, get_project_zip_meta, delete_project_zip, has_project_zip @@ -659,9 +659,9 @@ async def get_project_branches( config = config.scalar_one_or_none() github_token = settings.GITHUB_TOKEN - gitlab_token = settings.GITLAB_TOKEN - - SENSITIVE_OTHER_FIELDS = ['githubToken', 'gitlabToken'] + projects_gitea_token = settings.GITEA_TOKEN + + SENSITIVE_OTHER_FIELDS = ['githubToken', 'gitlabToken', 'giteaToken'] if config and config.other_config: import json @@ -673,12 +673,14 @@ async def get_project_branches( github_token = decrypted_val elif field == 'gitlabToken': gitlab_token = decrypted_val + elif field == 'giteaToken': + projects_gitea_token = decrypted_val repo_type = project.repository_type or "other" # 详细日志 print(f"[Branch] 项目: {project.name}, 类型: {repo_type}, URL: {project.repository_url}") - print(f"[Branch] GitHub Token: {'已配置' if github_token else '未配置'}, GitLab Token: {'已配置' if gitlab_token else '未配置'}") + print(f"[Branch] GitHub Token: {'已配置' if github_token else '未配置'}, GitLab Token: {'已配置' if gitlab_token else '未配置'}, Gitea Token: {'已配置' if projects_gitea_token else '未配置'}") try: if repo_type == "github": @@ -689,6 +691,10 @@ async def get_project_branches( if not gitlab_token: print("[Branch] 警告: GitLab Token 未配置,可能无法访问私有仓库") branches = await get_gitlab_branches(project.repository_url, gitlab_token) + elif repo_type == "gitea": + if not projects_gitea_token: + print("[Branch] 警告: Gitea Token 未配置,可能无法访问私有仓库") + branches = await get_gitea_branches(project.repository_url, projects_gitea_token) else: # 对于其他类型,返回默认分支 print(f"[Branch] 仓库类型 '{repo_type}' 不支持获取分支,返回默认分支") diff --git a/frontend/src/pages/Projects.tsx b/frontend/src/pages/Projects.tsx index f01b039..f9b1190 100644 --- a/frontend/src/pages/Projects.tsx +++ b/frontend/src/pages/Projects.tsx @@ -1018,6 +1018,7 @@ export default function Projects() { GITHUB GITLAB + GITEA OTHER