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

18
web/src/types/audit.ts Normal file
View File

@@ -0,0 +1,18 @@
export interface AuditLog {
id: number
userId: number
username: string
category: string
action: string
targetType: string
targetId: string
targetName: string
detail: string
clientIp: string
createdAt: string
}
export interface AuditLogListResult {
items: AuditLog[]
total: number
}

View File

@@ -26,9 +26,19 @@ export interface BackupRecordSummary {
completedAt?: string
}
export interface StorageUploadResultItem {
storageTargetId: number
storageTargetName: string
status: 'success' | 'failed'
storagePath?: string
fileSize?: number
error?: string
}
export interface BackupRecordDetail extends BackupRecordSummary {
logContent: string
logEvents?: BackupLogEvent[]
storageUploadResults?: StorageUploadResultItem[]
}
export interface BackupRecordListFilter {

View File

@@ -10,6 +10,8 @@ export interface BackupTaskSummary {
cronExpr: string
storageTargetId: number
storageTargetName: string
storageTargetIds: number[]
storageTargetNames: string[]
nodeId: number
nodeName?: string
tags: string
@@ -24,6 +26,7 @@ export interface BackupTaskSummary {
export interface BackupTaskDetail extends BackupTaskSummary {
sourcePath: string
sourcePaths: string[]
excludePatterns: string[]
dbHost: string
dbPort: number
@@ -40,6 +43,7 @@ export interface BackupTaskPayload {
enabled: boolean
cronExpr: string
sourcePath: string
sourcePaths: string[]
excludePatterns: string[]
dbHost: string
dbPort: number
@@ -48,6 +52,7 @@ export interface BackupTaskPayload {
dbName: string
dbPath: string
storageTargetId: number
storageTargetIds: number[]
nodeId: number
tags: string
retentionDays: number

View File

@@ -8,6 +8,7 @@ export interface StorageTargetSummary {
type: StorageTargetType
description: string
enabled: boolean
starred: boolean
updatedAt: string
lastTestedAt?: string
lastTestStatus: StorageTestStatus