mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
2a7879efaa
- Added support for backup integrity verification during export and restore processes. - Introduced progress dispatching for backup export and restore operations. - Implemented new API endpoints for inspecting remote backup integrity. - Enhanced user interface with progress indicators and warning dialogs for integrity issues. - Updated localization strings for new features and user feedback. - Refactored backup-related functions for better clarity and maintainability.
75 lines
2.4 KiB
TypeScript
75 lines
2.4 KiB
TypeScript
import type { Env, User } from './types';
|
|
import {
|
|
handleAdminExportBackup,
|
|
handleDownloadAdminRemoteBackup,
|
|
handleDeleteAdminRemoteBackup,
|
|
handleDownloadAdminBackupAttachment,
|
|
handleGetAdminBackupSettings,
|
|
handleGetAdminBackupSettingsRepairState,
|
|
handleInspectAdminRemoteBackup,
|
|
handleAdminImportBackup,
|
|
handleListAdminRemoteBackups,
|
|
handleRepairAdminBackupSettings,
|
|
handleRestoreAdminRemoteBackup,
|
|
handleRunAdminConfiguredBackup,
|
|
handleUpdateAdminBackupSettings,
|
|
} from './handlers/backup';
|
|
|
|
export async function handleAdminBackupRoute(
|
|
request: Request,
|
|
env: Env,
|
|
actorUser: User,
|
|
path: string,
|
|
method: string
|
|
): Promise<Response | null> {
|
|
if (path === '/api/admin/backup/export' && method === 'POST') {
|
|
return handleAdminExportBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/blob' && method === 'GET') {
|
|
return handleDownloadAdminBackupAttachment(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/settings') {
|
|
if (method === 'GET') return handleGetAdminBackupSettings(request, env, actorUser);
|
|
if (method === 'PUT') return handleUpdateAdminBackupSettings(request, env, actorUser);
|
|
return null;
|
|
}
|
|
|
|
if (path === '/api/admin/backup/settings/repair') {
|
|
if (method === 'GET') return handleGetAdminBackupSettingsRepairState(request, env, actorUser);
|
|
if (method === 'POST') return handleRepairAdminBackupSettings(request, env, actorUser);
|
|
return null;
|
|
}
|
|
|
|
if (path === '/api/admin/backup/run' && method === 'POST') {
|
|
return handleRunAdminConfiguredBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/remote' && method === 'GET') {
|
|
return handleListAdminRemoteBackups(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/remote/download' && method === 'GET') {
|
|
return handleDownloadAdminRemoteBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/remote/integrity' && method === 'GET') {
|
|
return handleInspectAdminRemoteBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/remote/file' && method === 'DELETE') {
|
|
return handleDeleteAdminRemoteBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/remote/restore' && method === 'POST') {
|
|
return handleRestoreAdminRemoteBackup(request, env, actorUser);
|
|
}
|
|
|
|
if (path === '/api/admin/backup/import' && method === 'POST') {
|
|
return handleAdminImportBackup(request, env, actorUser);
|
|
}
|
|
|
|
return null;
|
|
}
|