60 lines
1.3 KiB
Markdown
60 lines
1.3 KiB
Markdown
# Gitea Latest Project Fetcher
|
||
|
||
从 Gitea 服务器获取最新的项目(仓库)列表。
|
||
|
||
## 功能
|
||
|
||
- 通过 Gitea API 获取指定用户或组织的最新仓库
|
||
- 支持命令行使用(Python)
|
||
- 提供 Web 界面查看结果(Flask)
|
||
|
||
## 目录结构
|
||
|
||
```
|
||
gitea-latest-project-fetcher/
|
||
├── README.md
|
||
├── requirements.txt
|
||
├── cli.py # 命令行工具
|
||
├── web_app.py # Flask Web 应用
|
||
├── gitea_client.py # Gitea API 客户端
|
||
├── templates/
|
||
│ └── index.html # Web 页面
|
||
└── static/
|
||
└── style.css # 样式
|
||
```
|
||
|
||
## 安装
|
||
|
||
```bash
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
## 命令行使用
|
||
|
||
```bash
|
||
# 获取用户的最新仓库
|
||
python cli.py --base-url https://gitea.example.com --owner myuser --limit 5
|
||
|
||
# 使用 token(私有仓库需要)
|
||
python cli.py --base-url https://gitea.example.com --owner myuser --token YOUR_TOKEN
|
||
```
|
||
|
||
## Web 使用
|
||
|
||
```bash
|
||
python web_app.py
|
||
# 打开浏览器访问 http://127.0.0.1:5000
|
||
```
|
||
|
||
## 配置
|
||
|
||
可通过环境变量设置默认值:
|
||
|
||
- `GITEA_BASE_URL`:Gitea 服务器地址
|
||
- `GITEA_TOKEN`:访问令牌
|
||
|
||
## 说明
|
||
|
||
本工具使用 Gitea 的 REST API:`GET /api/v1/users/{owner}/repos`,
|
||
按更新时间排序后返回最新的仓库。
|