更新README.md,gitea仓库支持获取分支
This commit is contained in:
parent
0fb10f6f76
commit
630b8b1a60
25
README.md
25
README.md
|
|
@ -63,7 +63,7 @@
|
||||||
<td width="50%" align="center">
|
<td width="50%" align="center">
|
||||||
<strong>🗂️ 项目管理</strong><br/><br/>
|
<strong>🗂️ 项目管理</strong><br/><br/>
|
||||||
<img src="frontend/public/images/README-show/项目管理.png" alt="项目管理" width="95%"><br/>
|
<img src="frontend/public/images/README-show/项目管理.png" alt="项目管理" width="95%"><br/>
|
||||||
<em>GitHub/GitLab 导入,多项目协同管理</em>
|
<em>GitHub/GitLab/Gitea 导入,多项目协同管理</em>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -190,10 +190,22 @@ docker compose up -d
|
||||||
- PostgreSQL 14+
|
- PostgreSQL 14+
|
||||||
- Docker (用于沙箱)
|
- Docker (用于沙箱)
|
||||||
|
|
||||||
### 1. 后端启动
|
|
||||||
|
### 1. 手动启动数据库
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d redis db
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 后端启动
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd backend
|
cd backend
|
||||||
|
# 配置环境
|
||||||
|
cp env.example .env
|
||||||
|
|
||||||
# 激活虚拟环境 (推荐 uv/poetry)
|
# 激活虚拟环境 (推荐 uv/poetry)
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
|
@ -204,15 +216,18 @@ pip install -r requirements.txt
|
||||||
uvicorn app.main:app --reload
|
uvicorn app.main:app --reload
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. 前端启动
|
### 3. 前端启动
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd frontend
|
cd frontend
|
||||||
|
# 配置环境
|
||||||
|
cp .env.example .env
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. 沙箱环境
|
### 4. 沙箱环境
|
||||||
开发模式下,仍需通过 Docker 启动沙箱服务。
|
开发模式下,仍需通过 Docker 启动沙箱服务。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -304,7 +319,7 @@ DeepSeek-Coder · Codestral<br/>
|
||||||
| 🤖 **Agent 深度审计** | Multi-Agent 协作,自主编排审计策略 | Agent |
|
| 🤖 **Agent 深度审计** | Multi-Agent 协作,自主编排审计策略 | Agent |
|
||||||
| 🧠 **RAG 知识增强** | 代码语义理解,CWE/CVE 知识库检索 | Agent |
|
| 🧠 **RAG 知识增强** | 代码语义理解,CWE/CVE 知识库检索 | Agent |
|
||||||
| 🔒 **沙箱 PoC 验证** | Docker 隔离执行,验证漏洞有效性 | Agent |
|
| 🔒 **沙箱 PoC 验证** | Docker 隔离执行,验证漏洞有效性 | Agent |
|
||||||
| 🗂️ **项目管理** | GitHub/GitLab 导入,ZIP 上传,10+ 语言支持 | 通用 |
|
| 🗂️ **项目管理** | GitHub/GitLab/Gitea 导入,ZIP 上传,10+ 语言支持 | 通用 |
|
||||||
| ⚡ **即时分析** | 代码片段秒级分析,粘贴即用 | 通用 |
|
| ⚡ **即时分析** | 代码片段秒级分析,粘贴即用 | 通用 |
|
||||||
| 🔍 **五维检测** | Bug · 安全 · 性能 · 风格 · 可维护性 | 通用 |
|
| 🔍 **五维检测** | Bug · 安全 · 性能 · 风格 · 可维护性 | 通用 |
|
||||||
| 💡 **What-Why-How** | 精准定位 + 原因解释 + 修复建议 | 通用 |
|
| 💡 **What-Why-How** | 精准定位 + 原因解释 + 修复建议 | 通用 |
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ from app.models.user import User
|
||||||
from app.models.audit import AuditTask, AuditIssue
|
from app.models.audit import AuditTask, AuditIssue
|
||||||
from app.models.user_config import UserConfig
|
from app.models.user_config import UserConfig
|
||||||
import zipfile
|
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 (
|
from app.services.zip_storage import (
|
||||||
save_project_zip, load_project_zip, get_project_zip_meta,
|
save_project_zip, load_project_zip, get_project_zip_meta,
|
||||||
delete_project_zip, has_project_zip
|
delete_project_zip, has_project_zip
|
||||||
|
|
@ -659,9 +659,9 @@ async def get_project_branches(
|
||||||
config = config.scalar_one_or_none()
|
config = config.scalar_one_or_none()
|
||||||
|
|
||||||
github_token = settings.GITHUB_TOKEN
|
github_token = settings.GITHUB_TOKEN
|
||||||
gitlab_token = settings.GITLAB_TOKEN
|
projects_gitea_token = settings.GITEA_TOKEN
|
||||||
|
|
||||||
SENSITIVE_OTHER_FIELDS = ['githubToken', 'gitlabToken']
|
SENSITIVE_OTHER_FIELDS = ['githubToken', 'gitlabToken', 'giteaToken']
|
||||||
|
|
||||||
if config and config.other_config:
|
if config and config.other_config:
|
||||||
import json
|
import json
|
||||||
|
|
@ -673,12 +673,14 @@ async def get_project_branches(
|
||||||
github_token = decrypted_val
|
github_token = decrypted_val
|
||||||
elif field == 'gitlabToken':
|
elif field == 'gitlabToken':
|
||||||
gitlab_token = decrypted_val
|
gitlab_token = decrypted_val
|
||||||
|
elif field == 'giteaToken':
|
||||||
|
projects_gitea_token = decrypted_val
|
||||||
|
|
||||||
repo_type = project.repository_type or "other"
|
repo_type = project.repository_type or "other"
|
||||||
|
|
||||||
# 详细日志
|
# 详细日志
|
||||||
print(f"[Branch] 项目: {project.name}, 类型: {repo_type}, URL: {project.repository_url}")
|
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:
|
try:
|
||||||
if repo_type == "github":
|
if repo_type == "github":
|
||||||
|
|
@ -689,6 +691,10 @@ async def get_project_branches(
|
||||||
if not gitlab_token:
|
if not gitlab_token:
|
||||||
print("[Branch] 警告: GitLab Token 未配置,可能无法访问私有仓库")
|
print("[Branch] 警告: GitLab Token 未配置,可能无法访问私有仓库")
|
||||||
branches = await get_gitlab_branches(project.repository_url, 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:
|
else:
|
||||||
# 对于其他类型,返回默认分支
|
# 对于其他类型,返回默认分支
|
||||||
print(f"[Branch] 仓库类型 '{repo_type}' 不支持获取分支,返回默认分支")
|
print(f"[Branch] 仓库类型 '{repo_type}' 不支持获取分支,返回默认分支")
|
||||||
|
|
|
||||||
|
|
@ -1018,6 +1018,7 @@ export default function Projects() {
|
||||||
<SelectContent className="bg-[#0c0c12] border-gray-700">
|
<SelectContent className="bg-[#0c0c12] border-gray-700">
|
||||||
<SelectItem value="github">GITHUB</SelectItem>
|
<SelectItem value="github">GITHUB</SelectItem>
|
||||||
<SelectItem value="gitlab">GITLAB</SelectItem>
|
<SelectItem value="gitlab">GITLAB</SelectItem>
|
||||||
|
<SelectItem value="gitea">GITEA</SelectItem>
|
||||||
<SelectItem value="other">OTHER</SelectItem>
|
<SelectItem value="other">OTHER</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue