feat: add community enhancements — password reset, audit logs, multi-source backup

Three community-requested features:

1. CLI password reset: `backupx reset-password --username admin --password xxx`
   Docker users can run via `docker exec`. No full app init needed.

2. Audit logging: async fire-and-forget audit trail for all key operations
   (login, CRUD on tasks/targets/records, settings changes).
   New UI page at /audit with category filter and pagination.

3. Multi-source path backup: file backup tasks now support multiple source
   directories packed into a single tar archive. Backward compatible with
   existing single sourcePath field.
This commit is contained in:
Awuqing
2026-03-30 23:04:37 +08:00
parent b01828e3b4
commit 09698cc767
47 changed files with 1902 additions and 263 deletions

View File

@@ -64,7 +64,7 @@ BackupX 是一个面向 **Linux / macOS 服务器**的自托管备份管理平
## Features
### 📦 多种备份类型
- **文件/目录** — 支持自定义排除规则(如 `node_modules``*.log`
- **文件/目录** — 支持多源路径备份,自定义排除规则(如 `node_modules``*.log`
- **MySQL** — 通过 `mysqldump` 原生工具
- **SQLite** — 安全文件拷贝
- **PostgreSQL** — 通过 `pg_dump` 原生工具
@@ -103,11 +103,13 @@ BackupX 是一个面向 **Linux / macOS 服务器**的自托管备份管理平
- 可选备份文件加密
- 登录限流防暴力破解
- 节点 Token 认证(一次性显示,安全传输)
- CLI 密码重置Docker 用户通过 `docker exec` 执行,无需邮件找回)
### 📊 监控与通知
- 仪表盘统计(成功率、存储用量、备份趋势图表)
- 邮件 / Webhook / Telegram 通知
- 实时备份执行日志 (SSE)
- **审计日志** — 全操作链可溯源,记录登录、任务创建/修改/删除、备份执行/恢复等关键事件
### 🌐 其他
- 中英文国际化 (i18n)
@@ -310,6 +312,7 @@ BackupX/
│ │ ├── storage-targets/ # 存储目标
│ │ ├── nodes/ # 节点管理
│ │ ├── notifications/ # 通知配置
│ │ ├── audit/ # 审计日志
│ │ ├── settings/ # 系统设置
│ │ └── login/ # 登录页
│ ├── services/ # API 请求封装
@@ -407,6 +410,12 @@ docker build -t backupx .
docker run -d --name backupx -p 8340:8340 -v backupx-data:/app/data backupx
```
**密码重置**(忘记管理员密码时):
```bash
docker exec -it backupx /app/bin/backupx reset-password --username admin --password newpass123
```
通过环境变量覆盖配置:
```bash
@@ -435,6 +444,18 @@ scp server/config.example.yaml your-server:/etc/backupx/config.yaml
ssh your-server '/opt/backupx/bin/backupx -config /etc/backupx/config.yaml'
```
### 密码重置
忘记管理员密码时,可通过 CLI 直接重置(需要服务器 shell 权限):
```bash
# 裸机部署
./backupx reset-password --username admin --password newpass123
# Docker 部署
docker exec -it backupx /app/bin/backupx reset-password --username admin --password newpass123
```
### Nginx 配置示例
```nginx
@@ -491,6 +512,7 @@ server {
| | `POST /api/notifications/:id/test` | 测试已保存通知 |
| **仪表盘** | `GET /api/dashboard/stats` | 概览统计 |
| | `GET /api/dashboard/timeline` | 备份趋势时间线 |
| **审计日志** | `GET /api/audit-logs` | 审计日志列表 (支持分类筛选/分页) |
| **系统** | `GET /api/system/info` | 系统信息 (版本/磁盘) |
| | `GET/PUT /api/settings` | 系统设置读写 |