fix: 端口更换 & 代码审核修复

端口:
- 服务端口 8000 → 7329
- 前端开发端口 5173 → 7330

安全:
- CORS 收紧为白名单,关闭 credentials
- SPA 路由白名单完善
- 前端 XSS 转义

可靠性:
- 时区统一为 datetime.now(timezone.utc)
- 文章入库改为内存去重 + 增量计数
- OPML 导入改为 body 参数接收
- OPML 导出 URL XML 转义
- 首次抓取改为 BackgroundTasks 异步
- articles.py HTTPException 移到顶部 import
- FTS5 异常显式日志
- FTS5 查询加引号包裹防布尔注入
- 中文摘要支持中文标点
- 去掉未使用的 hashlib import

部署:
- Dockerfile 锁 python:3.12.7-slim
- requirements 锁定具体版本
- healthcheck 不用 curl(镜像里没有)
- docker-compose 使用 .env 文件
- 新增 .env 配置文件
This commit is contained in:
congsh
2026-06-11 14:31:29 +08:00
parent 54e7db0ef0
commit c59dd304f7
17 changed files with 701 additions and 106 deletions
+10 -10
View File
@@ -20,10 +20,10 @@ RSS 抓取、管理与检索系统。支持 Docker 部署,包含 Web UI 和 RE
git clone <repo-url>
cd rssKeeper
# 启动
# 启动(服务运行在 7329 端口)
docker-compose up -d --build
# 访问 http://localhost:8000
# 访问 http://localhost:7329
```
### 开发模式
@@ -32,9 +32,9 @@ docker-compose up -d --build
# 后端
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 7329
# 前端(另开终端)
# 前端(另开终端,运行在 7330 端口
cd frontend
npm install
npm run dev
@@ -46,31 +46,31 @@ npm run dev
```bash
# 获取最近 24 小时的文章
curl "http://localhost:8000/api/v1/external/recent?hours=24&limit=50"
curl "http://localhost:7329/api/v1/external/recent?hours=24&limit=50"
# 指定 RSS 源
curl "http://localhost:8000/api/v1/external/recent?feed_id=1&hours=48"
curl "http://localhost:7329/api/v1/external/recent?feed_id=1&hours=48"
# 指定分类
curl "http://localhost:8000/api/v1/external/recent?category=科技&hours=24"
curl "http://localhost:7329/api/v1/external/recent?category=科技&hours=24"
```
### 获取源列表
```bash
curl "http://localhost:8000/api/v1/external/feeds"
curl "http://localhost:7329/api/v1/external/feeds"
```
### 按源获取文章
```bash
curl "http://localhost:8000/api/v1/external/feeds/1/articles?limit=100"
curl "http://localhost:7329/api/v1/external/feeds/1/articles?limit=100"
```
### 获取每日摘要
```bash
curl "http://localhost:8000/api/v1/external/summary?date=2024-06-01"
curl "http://localhost:7329/api/v1/external/summary?date=2024-06-01"
```
## 技术栈