mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-05-20 15:49:31 +08:00
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:
7
web/src/services/audit.ts
Normal file
7
web/src/services/audit.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { http } from './http'
|
||||
import type { AuditLogListResult } from '../types/audit'
|
||||
|
||||
export async function listAuditLogs(params: { category?: string; limit?: number; offset?: number }) {
|
||||
const response = await http.get<{ code: string; message: string; data: AuditLogListResult }>('/audit-logs', { params })
|
||||
return response.data.data
|
||||
}
|
||||
18
web/src/services/database.ts
Normal file
18
web/src/services/database.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { http, type ApiEnvelope, unwrapApiEnvelope } from './http'
|
||||
|
||||
export interface DatabaseDiscoverPayload {
|
||||
type: 'mysql' | 'postgresql'
|
||||
host: string
|
||||
port: number
|
||||
user: string
|
||||
password: string
|
||||
}
|
||||
|
||||
interface DatabaseDiscoverResult {
|
||||
databases: string[]
|
||||
}
|
||||
|
||||
export async function discoverDatabases(payload: DatabaseDiscoverPayload): Promise<string[]> {
|
||||
const response = await http.post<ApiEnvelope<DatabaseDiscoverResult>>('/database/discover', payload, { timeout: 10000 })
|
||||
return unwrapApiEnvelope(response.data).databases ?? []
|
||||
}
|
||||
@@ -74,6 +74,11 @@ export interface StorageTargetUsage {
|
||||
totalSize: number
|
||||
}
|
||||
|
||||
export async function toggleStorageTargetStar(id: number) {
|
||||
const response = await http.put<ApiEnvelope<StorageTargetSummary>>(`/storage-targets/${id}/star`)
|
||||
return unwrap(response.data)
|
||||
}
|
||||
|
||||
export async function getStorageTargetUsage(id: number) {
|
||||
const response = await http.get<ApiEnvelope<StorageTargetUsage>>(`/storage-targets/${id}/usage`)
|
||||
return unwrap(response.data)
|
||||
|
||||
Reference in New Issue
Block a user