mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-21 05:10:41 +00:00
feat: add shared API utilities for handling requests and responses
- Introduced `shared.ts` with utility functions for API interactions, including JSON parsing, error handling, and content disposition parsing. - Added `vault.ts` to manage vault-related operations such as folder and cipher management, including creation, deletion, and bulk operations. - Implemented encryption and decryption methods for secure data handling within the vault. - Created `backup-settings-repair.ts` to automatically repair backup settings for admin profiles if needed.
This commit is contained in:
@@ -5,8 +5,8 @@ import {
|
||||
type BackupSettings,
|
||||
createBackupDestinationRecord,
|
||||
createDefaultBackupSettings,
|
||||
} from '@shared/backup';
|
||||
import type { RemoteBackupBrowserResponse, RemoteBackupItem } from './api';
|
||||
} from '@shared/backup-schema';
|
||||
import type { RemoteBackupBrowserResponse, RemoteBackupItem } from './api/backup';
|
||||
import { t } from './i18n';
|
||||
|
||||
export interface PersistedRemoteBrowserState {
|
||||
@@ -52,7 +52,6 @@ export function detectBrowserTimeZone(): string {
|
||||
|
||||
function createLocalizedDestinationName(type: BackupDestinationType, index: number): string {
|
||||
if (type === 'e3') return t('txt_backup_destination_name_default_e3', { index: String(index) });
|
||||
if (type === 'placeholder') return `${t('txt_backup_destination_reserved')} ${index}`;
|
||||
return t('txt_backup_destination_name_default_webdav', { index: String(index) });
|
||||
}
|
||||
|
||||
@@ -197,7 +196,7 @@ export function getDestinationById(
|
||||
}
|
||||
|
||||
export function getVisibleDestinations(settings: BackupSettings | null | undefined): BackupDestinationRecord[] {
|
||||
return (settings?.destinations || []).filter((destination) => destination.type !== 'placeholder');
|
||||
return settings?.destinations || [];
|
||||
}
|
||||
|
||||
export function getFirstVisibleDestinationId(settings: BackupSettings | null | undefined): string | null {
|
||||
@@ -206,6 +205,5 @@ export function getFirstVisibleDestinationId(settings: BackupSettings | null | u
|
||||
|
||||
export function getDestinationTypeLabel(type: BackupDestinationType): string {
|
||||
if (type === 'e3') return t('txt_backup_protocol_e3');
|
||||
if (type === 'placeholder') return t('txt_backup_destination_reserved');
|
||||
return t('txt_backup_protocol_webdav');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user