feat: add backup recommendations and update backup strategy UI

- Introduced new backup recommendations feature with interfaces for recommended storage providers.
- Updated i18n translations for backup strategy to reflect new terminology and improved descriptions.
- Enhanced types with optional private and public keys in user profiles.
- Redesigned backup-related styles for better layout and responsiveness.
- Updated TypeScript configuration to include shared modules.
- Configured Vite to resolve shared modules and allow filesystem access.
- Added cron triggers for periodic tasks in Wrangler configuration.
This commit is contained in:
shuaiplus
2026-03-15 03:34:16 +08:00
parent 51d0e60cf1
commit b1c6ec50da
29 changed files with 5662 additions and 951 deletions
+65
View File
@@ -0,0 +1,65 @@
import { base64ToBytes, decryptBw } from './crypto';
import type { AdminBackupSettings, BackupSettingsPortablePayload } from './api';
import type { Profile, SessionState } from './types';
const PORTABLE_ALGORITHM = 'RSA-OAEP';
const PORTABLE_HASH = 'SHA-1';
const AES_GCM_ALGORITHM = 'AES-GCM';
async function importPortablePrivateKey(pkcs8: Uint8Array): Promise<CryptoKey> {
return crypto.subtle.importKey(
'pkcs8',
pkcs8,
{ name: PORTABLE_ALGORITHM, hash: PORTABLE_HASH },
false,
['decrypt']
);
}
async function importPortableAesKey(keyBytes: Uint8Array): Promise<CryptoKey> {
return crypto.subtle.importKey('raw', keyBytes, { name: AES_GCM_ALGORITHM }, false, ['decrypt']);
}
export async function decryptPortableBackupSettings(
portable: BackupSettingsPortablePayload,
profile: Profile,
session: SessionState
): Promise<AdminBackupSettings> {
if (!profile.id) {
throw new Error('Current administrator profile is missing an id');
}
if (!profile.privateKey) {
throw new Error('Current administrator profile is missing a private key');
}
if (!session.symEncKey || !session.symMacKey) {
throw new Error('Current session is missing unlocked vault keys');
}
const wrap = portable.wraps.find((entry) => entry.userId === profile.id);
if (!wrap) {
throw new Error('No portable backup settings wrap is available for the current administrator');
}
const privateKeyBytes = await decryptBw(
profile.privateKey,
base64ToBytes(session.symEncKey),
base64ToBytes(session.symMacKey)
);
const privateKey = await importPortablePrivateKey(privateKeyBytes);
const portableDek = new Uint8Array(
await crypto.subtle.decrypt(
{ name: PORTABLE_ALGORITHM },
privateKey,
base64ToBytes(wrap.wrappedKey)
)
);
const aesKey = await importPortableAesKey(portableDek);
const plaintext = new Uint8Array(
await crypto.subtle.decrypt(
{ name: AES_GCM_ALGORITHM, iv: base64ToBytes(portable.iv) },
aesKey,
base64ToBytes(portable.ciphertext)
)
);
return JSON.parse(new TextDecoder().decode(plaintext)) as AdminBackupSettings;
}
+198 -5
View File
@@ -18,6 +18,13 @@ import type {
VaultDraftField,
WebConfigResponse,
} from './types';
import type {
BackupDestinationRecord,
BackupDestinationType,
BackupSettings as AdminBackupSettings,
E3BackupDestination,
WebDavBackupDestination,
} from '@shared/backup';
const SESSION_KEY = 'nodewarden.web.session.v4';
const DEVICE_IDENTIFIER_KEY = 'nodewarden.web.device.identifier.v1';
@@ -932,6 +939,64 @@ export async function deleteUser(authedFetch: (input: string, init?: RequestInit
if (!resp.ok) throw new Error('Delete user failed');
}
export type {
BackupDestinationConfig,
BackupDestinationRecord,
BackupDestinationType,
BackupRuntimeState,
BackupScheduleConfig,
BackupSettings as AdminBackupSettings,
E3BackupDestination,
PlaceholderBackupDestination,
WebDavBackupDestination,
} from '@shared/backup';
export interface BackupSettingsPortableWrap {
userId: string;
wrappedKey: string;
}
export interface BackupSettingsPortablePayload {
iv: string;
ciphertext: string;
wraps: BackupSettingsPortableWrap[];
}
export interface BackupSettingsRepairStateResponse {
object: 'backup-settings-repair';
needsRepair: boolean;
portable: BackupSettingsPortablePayload | null;
}
export interface AdminBackupRunResponse {
object: 'backup-run';
result: {
fileName: string;
fileSize: number;
provider: string;
remotePath: string;
};
settings: AdminBackupSettings;
}
export interface RemoteBackupItem {
path: string;
name: string;
isDirectory: boolean;
size: number | null;
modifiedAt: string | null;
}
export interface RemoteBackupBrowserResponse {
object: 'backup-remote-browser';
destinationId: string;
destinationName: string;
provider: BackupDestinationType;
currentPath: string;
parentPath: string | null;
items: RemoteBackupItem[];
}
export interface AdminBackupImportCounts {
config: number;
users: number;
@@ -959,21 +1024,149 @@ export async function exportAdminBackup(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>
): Promise<AdminBackupExportPayload> {
const resp = await authedFetch('/api/admin/backup/export', { method: 'POST' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, 'Backup export failed'));
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_export_failed')));
const mimeType = String(resp.headers.get('Content-Type') || 'application/zip').trim() || 'application/zip';
const fileName = parseContentDispositionFileName(resp, 'nodewarden_instance_backup.zip');
const fileName = parseContentDispositionFileName(resp, 'nodewarden_backup.zip');
const bytes = new Uint8Array(await resp.arrayBuffer());
return { fileName, mimeType, bytes };
}
export async function getAdminBackupSettings(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>
): Promise<AdminBackupSettings> {
const resp = await authedFetch('/api/admin/backup/settings', { method: 'GET' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_settings_load_failed')));
const body = await parseJson<AdminBackupSettings>(resp);
if (!Array.isArray(body?.destinations)) throw new Error(t('txt_backup_settings_invalid_response'));
return body;
}
export async function saveAdminBackupSettings(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
settings: AdminBackupSettings
): Promise<AdminBackupSettings> {
const resp = await authedFetch('/api/admin/backup/settings', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(settings),
});
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_settings_save_failed')));
const body = await parseJson<AdminBackupSettings>(resp);
if (!Array.isArray(body?.destinations)) throw new Error(t('txt_backup_settings_invalid_response'));
return body;
}
export async function getAdminBackupSettingsRepairState(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>
): Promise<BackupSettingsRepairStateResponse> {
const resp = await authedFetch('/api/admin/backup/settings/repair', { method: 'GET' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_settings_load_failed')));
const body = await parseJson<BackupSettingsRepairStateResponse>(resp);
if (!body || typeof body.needsRepair !== 'boolean') {
throw new Error(t('txt_backup_settings_invalid_response'));
}
return body;
}
export async function repairAdminBackupSettings(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
settings: AdminBackupSettings
): Promise<AdminBackupSettings> {
const resp = await authedFetch('/api/admin/backup/settings/repair', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(settings),
});
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_settings_save_failed')));
const body = await parseJson<AdminBackupSettings>(resp);
if (!Array.isArray(body?.destinations)) throw new Error(t('txt_backup_settings_invalid_response'));
return body;
}
export async function runAdminBackupNow(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
destinationId?: string | null
): Promise<AdminBackupRunResponse> {
const resp = await authedFetch('/api/admin/backup/run', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(destinationId ? { destinationId } : {}),
});
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_remote_run_failed')));
const body = await parseJson<AdminBackupRunResponse>(resp);
if (!body?.result || !body?.settings) throw new Error(t('txt_backup_remote_run_invalid_response'));
return body;
}
export async function listRemoteBackups(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
destinationId: string,
path: string = ''
): Promise<RemoteBackupBrowserResponse> {
const params = new URLSearchParams();
params.set('destinationId', destinationId);
if (path) params.set('path', path);
const query = `?${params.toString()}`;
const resp = await authedFetch(`/api/admin/backup/remote${query}`, { method: 'GET' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_remote_load_failed')));
const body = await parseJson<RemoteBackupBrowserResponse>(resp);
if (!body?.items || typeof body.currentPath !== 'string' || !body.destinationId) throw new Error(t('txt_backup_remote_invalid_response'));
return body;
}
export async function downloadRemoteBackup(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
destinationId: string,
path: string
): Promise<AdminBackupExportPayload> {
const params = new URLSearchParams();
params.set('destinationId', destinationId);
params.set('path', path);
const resp = await authedFetch(`/api/admin/backup/remote/download?${params.toString()}`, { method: 'GET' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_remote_download_failed')));
const mimeType = String(resp.headers.get('Content-Type') || 'application/zip').trim() || 'application/zip';
const fileName = parseContentDispositionFileName(resp, 'nodewarden_remote_backup.zip');
const bytes = new Uint8Array(await resp.arrayBuffer());
return { fileName, mimeType, bytes };
}
export async function deleteRemoteBackup(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
destinationId: string,
path: string
): Promise<void> {
const params = new URLSearchParams();
params.set('destinationId', destinationId);
params.set('path', path);
const resp = await authedFetch(`/api/admin/backup/remote/file?${params.toString()}`, { method: 'DELETE' });
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_remote_delete_failed')));
}
export async function restoreRemoteBackup(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
destinationId: string,
path: string,
replaceExisting: boolean = false
): Promise<AdminBackupImportResponse> {
const resp = await authedFetch('/api/admin/backup/remote/restore', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ destinationId, path, replaceExisting }),
});
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_remote_restore_failed')));
const body = await parseJson<AdminBackupImportResponse>(resp);
if (!body?.imported) throw new Error(t('txt_backup_remote_restore_invalid_response'));
return body;
}
export async function importAdminBackup(
authedFetch: (input: string, init?: RequestInit) => Promise<Response>,
file: File,
replaceExisting: boolean = false
): Promise<AdminBackupImportResponse> {
const formData = new FormData();
formData.set('file', file, file.name || 'nodewarden_instance_backup.zip');
formData.set('file', file, file.name || 'nodewarden_backup.zip');
if (replaceExisting) {
formData.set('replaceExisting', '1');
}
@@ -982,10 +1175,10 @@ export async function importAdminBackup(
method: 'POST',
body: formData,
});
if (!resp.ok) throw new Error(await parseErrorMessage(resp, 'Backup import failed'));
if (!resp.ok) throw new Error(await parseErrorMessage(resp, t('txt_backup_import_failed')));
const body = await parseJson<AdminBackupImportResponse>(resp);
if (!body?.imported) throw new Error('Invalid backup import response');
if (!body?.imported) throw new Error(t('txt_backup_import_invalid_response'));
return body;
}
+204
View File
@@ -0,0 +1,204 @@
import {
type BackupDestinationRecord,
type BackupDestinationType,
type BackupRuntimeState,
type BackupSettings,
createBackupDestinationRecord,
createDefaultBackupSettings,
} from '@shared/backup';
import type { RemoteBackupBrowserResponse, RemoteBackupItem } from './api';
import { t } from './i18n';
export interface PersistedRemoteBrowserState {
cache: Record<string, RemoteBackupBrowserResponse>;
pathByDestination: Record<string, string>;
pageByKey: Record<string, number>;
selectedDestinationId: string | null;
}
export const REMOTE_BROWSER_STORAGE_KEY = 'nodewarden.backup.remote-browser.v1';
export const REMOTE_BROWSER_ITEMS_PER_PAGE = 10;
export const COMMON_TIME_ZONES = [
'UTC',
'Asia/Shanghai',
'Asia/Tokyo',
'Asia/Singapore',
'Europe/London',
'Europe/Berlin',
'America/New_York',
'America/Chicago',
'America/Denver',
'America/Los_Angeles',
];
export const WEEKDAY_OPTIONS = [
{ value: 1, label: 'txt_backup_weekday_monday' },
{ value: 2, label: 'txt_backup_weekday_tuesday' },
{ value: 3, label: 'txt_backup_weekday_wednesday' },
{ value: 4, label: 'txt_backup_weekday_thursday' },
{ value: 5, label: 'txt_backup_weekday_friday' },
{ value: 6, label: 'txt_backup_weekday_saturday' },
{ value: 0, label: 'txt_backup_weekday_sunday' },
] as const;
export function detectBrowserTimeZone(): string {
try {
return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
} catch {
return 'UTC';
}
}
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) });
}
export function createDraftDestinationRecord(type: BackupDestinationType, index: number): BackupDestinationRecord {
return createBackupDestinationRecord(type, index, {
timezone: detectBrowserTimeZone(),
name: createLocalizedDestinationName(type, index),
});
}
export function createDraftBackupSettings(): BackupSettings {
return createDefaultBackupSettings(detectBrowserTimeZone(), {
destinationName: createLocalizedDestinationName('webdav', 1),
});
}
export function formatDateTime(value: string | null | undefined): string {
if (!value) return t('txt_backup_never');
const parsed = new Date(value);
if (!Number.isFinite(parsed.getTime())) return value;
return parsed.toLocaleString();
}
export function formatBytes(value: number | null | undefined): string {
const n = Number(value || 0);
if (!Number.isFinite(n) || n <= 0) return t('txt_backup_unknown_size');
if (n < 1024) return `${n} B`;
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
}
export function isReplaceRequiredError(error: unknown): boolean {
const message = error instanceof Error ? String(error.message || '') : '';
return message.toLowerCase().includes('fresh instance');
}
export function isZipCandidate(item: RemoteBackupItem): boolean {
return !item.isDirectory && /\.zip$/i.test(item.name || '');
}
function getRemoteItemSortTime(item: RemoteBackupItem): number {
if (!item.modifiedAt) return 0;
const parsed = new Date(item.modifiedAt);
return Number.isFinite(parsed.getTime()) ? parsed.getTime() : 0;
}
export function compareRemoteItems(a: RemoteBackupItem, b: RemoteBackupItem): number {
const timeDiff = getRemoteItemSortTime(b) - getRemoteItemSortTime(a);
if (timeDiff !== 0) return timeDiff;
if (a.isDirectory !== b.isDirectory) return a.isDirectory ? -1 : 1;
return b.name.localeCompare(a.name, 'en');
}
export function getRemoteBrowserCacheKey(destinationId: string, path: string = ''): string {
return `${destinationId}:${path}`;
}
function getRemoteBrowserStorage(): Storage | null {
try {
if (typeof window !== 'undefined' && window.localStorage) {
return window.localStorage;
}
} catch {
// Ignore storage access failures.
}
try {
if (typeof window !== 'undefined' && window.sessionStorage) {
return window.sessionStorage;
}
} catch {
// Ignore storage access failures.
}
return null;
}
export function loadPersistedRemoteBrowserState(): PersistedRemoteBrowserState {
try {
const storage = getRemoteBrowserStorage();
const raw = storage?.getItem(REMOTE_BROWSER_STORAGE_KEY);
if (!raw) {
return {
cache: {},
pathByDestination: {},
pageByKey: {},
selectedDestinationId: null,
};
}
const parsed = JSON.parse(raw) as Partial<PersistedRemoteBrowserState>;
return {
cache: parsed.cache && typeof parsed.cache === 'object' ? parsed.cache : {},
pathByDestination: parsed.pathByDestination && typeof parsed.pathByDestination === 'object' ? parsed.pathByDestination : {},
pageByKey: parsed.pageByKey && typeof parsed.pageByKey === 'object' ? parsed.pageByKey : {},
selectedDestinationId: typeof parsed.selectedDestinationId === 'string' ? parsed.selectedDestinationId : null,
};
} catch {
return {
cache: {},
pathByDestination: {},
pageByKey: {},
selectedDestinationId: null,
};
}
}
export function persistRemoteBrowserState(state: PersistedRemoteBrowserState): void {
try {
const storage = getRemoteBrowserStorage();
storage?.setItem(REMOTE_BROWSER_STORAGE_KEY, JSON.stringify(state));
} catch {
// Ignore cache persistence failures.
}
}
export function invalidateRemoteBrowserCacheForDestination(
destinationId: string,
cache: Record<string, RemoteBackupBrowserResponse>,
pathByDestination: Record<string, string>,
pageByKey: Record<string, number>
): PersistedRemoteBrowserState {
return {
cache: Object.fromEntries(Object.entries(cache).filter(([key]) => !key.startsWith(`${destinationId}:`))),
pathByDestination: Object.fromEntries(Object.entries(pathByDestination).filter(([key]) => key !== destinationId)),
pageByKey: Object.fromEntries(Object.entries(pageByKey).filter(([key]) => !key.startsWith(`${destinationId}:`))),
selectedDestinationId: destinationId,
};
}
export function getDestinationById(
settings: BackupSettings | null,
destinationId: string | null | undefined
): BackupDestinationRecord | null {
if (!settings || !destinationId) return null;
return settings.destinations.find((destination) => destination.id === destinationId) || null;
}
export function getVisibleDestinations(settings: BackupSettings | null | undefined): BackupDestinationRecord[] {
return (settings?.destinations || []).filter((destination) => destination.type !== 'placeholder');
}
export function getFirstVisibleDestinationId(settings: BackupSettings | null | undefined): string | null {
return getVisibleDestinations(settings)[0]?.id || null;
}
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');
}
+68
View File
@@ -0,0 +1,68 @@
export interface RecommendedStorageLink {
name: string;
capacity: string;
}
export interface RecommendedProviderBase {
id: 'infinicloud' | 'koofr' | 'pcloud';
name: string;
capacity: string;
protocol: 'webdav' | 's3';
signupUrl: string;
hasAffiliateLink?: boolean;
}
export interface InfinicloudProvider extends RecommendedProviderBase {
id: 'infinicloud';
referralCode: string;
}
export interface KoofrProvider extends RecommendedProviderBase {
id: 'koofr';
passwordUrl: string;
storageUrl: string;
linkedStorages: RecommendedStorageLink[];
}
export interface PcloudProvider extends RecommendedProviderBase {
id: 'pcloud';
}
export type RecommendedProvider = InfinicloudProvider | KoofrProvider | PcloudProvider;
export const RECOMMENDED_PROVIDERS: RecommendedProvider[] = [
{
id: 'infinicloud',
name: 'InfiniCLOUD',
capacity: '25G',
protocol: 'webdav',
signupUrl: 'https://infini-cloud.net/en/',
referralCode: '2HC5E',
},
{
id: 'koofr',
name: 'Koofr',
capacity: '10G',
protocol: 'webdav',
signupUrl: 'https://app.koofr.net/signup',
passwordUrl: 'https://app.koofr.net/app/admin/preferences/password',
storageUrl: 'https://app.koofr.net/app/storage/',
linkedStorages: [
{ name: 'Google Drive', capacity: '15G' },
{ name: 'OneDrive', capacity: '5G' },
{ name: 'Dropbox', capacity: '2G' },
],
},
{
id: 'pcloud',
name: 'pCloud',
capacity: '10G',
protocol: 'webdav',
signupUrl: 'https://u.pcloud.com/#/register?invite=GITx7ZvEU1N7',
hasAffiliateLink: true,
},
];
export function hasLinkedStorages(provider: RecommendedProvider): provider is KoofrProvider {
return provider.id === 'koofr';
}
+330 -18
View File
@@ -9,29 +9,185 @@ const messages: Record<Locale, Record<string, string>> = {
nav_device_management: "Device Management",
nav_my_vault: "My Vault",
nav_sends: "Sends",
nav_backup_strategy: "Backup Strategy",
nav_backup_strategy: "Backup Center",
nav_import_export: "Import & Export",
backup_strategy_title: "Backup Strategy",
backup_strategy_title: "Backup Center",
backup_strategy_under_construction: "Under construction.",
import_export_title: "Import & Export",
import_export_under_construction: "Under construction.",
txt_backup_export: "Backup Export",
txt_backup_import: "Backup Import",
txt_backup_export: "Export Backup",
txt_backup_import: "Restore",
txt_backup_export_description: "Download a full instance backup ZIP for manual safekeeping.",
txt_backup_import_description: "Upload a previously exported backup ZIP and restore it into a fresh instance shell.",
txt_backup_import_description: "Upload a previously exported backup ZIP and restore it into this instance.",
txt_backup_exporting: "Exporting...",
txt_backup_importing: "Importing...",
txt_backup_importing: "Restoring...",
txt_backup_restoring: "Restoring...",
txt_backup_export_success: "Backup exported",
txt_backup_import_success_relogin: "Backup imported. Please sign in again.",
txt_backup_import_success_relogin: "Backup restored. Please sign in again.",
txt_backup_restore_success_relogin: "Backup restored. Please sign in again.",
txt_backup_export_failed: "Backup export failed",
txt_backup_import_failed: "Backup import failed",
txt_backup_import_failed: "Backup restore failed",
txt_backup_restore_failed: "Backup restore failed",
txt_backup_center_title: "Instance Backup",
txt_backup_center_description: "Keep local exports for manual restore, and configure one daily remote backup target for unattended protection.",
txt_backup_restore_note: "Restoring will overwrite the current instance if you choose the replace flow.",
txt_backup_manual: "Manual Backup",
txt_backup_manual_description: "Export a ZIP right now, or import a ZIP back into this instance.",
txt_backup_destinations_title: "Backup Destinations",
txt_backup_destinations_description: "Keep multiple WebDAV and E3 targets here. Select one on the left to edit or browse it.",
txt_backup_recommend_title: "Recommended Storage",
txt_backup_recommend_open_signup: "Open Signup",
txt_backup_recommend_open_signup_aff: "Open Signup (AFF)",
txt_backup_recommend_open_guide: "Open Guide",
txt_backup_recommend_empty: "No recommendations yet.",
txt_backup_recommend_referral_label: "Referral Code",
txt_backup_recommend_referral_note: "Use it during signup to get 5 GB extra. The author receives 2 GB.",
txt_backup_recommend_infinicloud_summary: "Only an email address is needed. 20 GB free, 25 GB total with the referral code.",
txt_backup_recommend_infinicloud_step_1: "Register an InfiniCLOUD account with just your email address.",
txt_backup_recommend_infinicloud_step_2_prefix: "Open",
txt_backup_recommend_infinicloud_step_2_suffix: "and turn on Apps Connection.",
txt_backup_recommend_infinicloud_step_3: "Use Connection ID as your WebDAV username and Apps Password as your WebDAV password.",
txt_backup_recommend_infinicloud_step_4: "Enter referral code 2HC5E in Referral Bonus at the bottom of My Page to receive 5 GB extra.",
txt_backup_recommend_open_password: "Password Settings",
txt_backup_recommend_open_storage: "Open Storage",
txt_backup_recommend_koofr_summary: "Only an email address is needed. 10 GB free, and it can bridge Google Drive, OneDrive, and Dropbox through WebDAV.",
txt_backup_recommend_koofr_password_link: "Password Settings",
txt_backup_recommend_koofr_storage_link: "Storage",
txt_backup_recommend_koofr_step_1: "Register a Koofr account with just your email address.",
txt_backup_recommend_koofr_step_2_prefix: "Open",
txt_backup_recommend_koofr_step_2_suffix: ", generate a new app password, use your email address as the WebDAV username, and use the app password as the WebDAV password.",
txt_backup_recommend_koofr_step_3: "Koofr's own WebDAV address is https://app.koofr.net/dav/Koofr.",
txt_backup_recommend_koofr_step_4: "Koofr can also connect Google Drive, OneDrive, and Dropbox. Free users can connect up to two storage accounts.",
txt_backup_recommend_koofr_step_5_prefix: "Open",
txt_backup_recommend_koofr_step_5_suffix: ", click Connect in the left sidebar, and choose the cloud storage you want to attach.",
txt_backup_recommend_koofr_dav_intro: "After a storage account is connected, keep the same email and app password, and only switch the WebDAV address:",
txt_backup_recommend_koofr_dav_self: "Koofr",
txt_backup_recommend_pcloud_summary: "Only an email address is needed. Up to 10 GB free, with standard WebDAV access.",
txt_backup_recommend_pcloud_step_1: "Register a pCloud account with just your email address.",
txt_backup_recommend_pcloud_step_2: "Use https://webdav.pcloud.com/ as the WebDAV server URL.",
txt_backup_recommend_pcloud_step_3: "Use your registration email as the WebDAV username and your account password as the WebDAV password.",
txt_backup_add_destination: "Add Destination",
txt_backup_schedule_panel_title: "Automatic Schedule",
txt_backup_schedule_panel_note: "Each destination can keep its own daily backup schedule.",
txt_backup_scheduled_target: "Scheduled Target",
txt_backup_destination_active_badge: "Auto On",
txt_backup_destination_idle_badge: "Auto Off",
txt_backup_destination_last_success: "Last success: {time}",
txt_backup_destination_never_run: "No successful run yet",
txt_backup_destination_detail_title: "Destination Details",
txt_backup_destination_detail_note: "",
txt_backup_destination_name: "Destination Name",
txt_backup_set_scheduled_target: "Use For Daily Backup",
txt_backup_delete_destination: "Delete",
txt_backup_destination_deleted: "Backup destination deleted",
txt_backup_delete_destination_confirm_message: "Delete backup destination \"{name}\"? This cannot be undone.",
txt_backup_select_destination: "Select a backup destination from the list first.",
txt_backup_remote_save_first: "Save this destination first before browsing its remote backup files.",
txt_backup_automation: "Automatic Backup",
txt_backup_automation_description: "Pick a destination, save the credentials, and let the worker upload one backup every day.",
txt_backup_settings_saved: "Backup settings saved",
txt_backup_settings_save_failed: "Saving backup settings failed",
txt_backup_settings_load_failed: "Loading backup settings failed",
txt_backup_save_settings: "Save Settings",
txt_backup_saving: "Saving...",
txt_backup_enable_action: "Enable",
txt_backup_disable_action: "Disable",
txt_backup_run_now: "Run Remote Backup Now",
txt_backup_run_manual: "Run Manually",
txt_backup_running_now: "Running...",
txt_backup_remote_run_success: "Remote backup completed",
txt_backup_remote_run_failed: "Remote backup failed",
txt_backup_remote_title: "Remote Backups",
txt_backup_remote_note: "Browse the saved destination and choose a backup ZIP to download or restore.",
txt_backup_remote_saved_basis: "Remote browsing uses the last saved destination settings, not unsaved form edits.",
txt_backup_remote_refresh: "Refresh",
txt_backup_remote_root: "Root",
txt_backup_remote_up: "Up",
txt_backup_remote_open: "Open",
txt_backup_remote_download: "Download",
txt_backup_remote_downloading: "Downloading...",
txt_backup_remote_restore: "Restore",
txt_backup_remote_loading: "Loading remote backups...",
txt_backup_remote_cached_empty: "Click Refresh to load this destination.",
txt_backup_remote_empty: "No backup files found in this folder.",
txt_backup_remote_folder: "Folder",
txt_backup_remote_unknown_time: "Unknown time",
txt_backup_remote_current_path: "Current Folder",
txt_backup_remote_load_failed: "Loading remote backups failed",
txt_backup_remote_invalid_response: "Invalid remote backup response",
txt_backup_remote_download_failed: "Downloading remote backup failed",
txt_backup_remote_delete_success: "Remote backup deleted",
txt_backup_remote_delete_failed: "Deleting remote backup failed",
txt_backup_remote_delete_confirm_message: "Delete backup file \"{name}\"? This cannot be undone.",
txt_backup_remote_deleting: "Deleting...",
txt_backup_remote_restore_failed: "Restoring remote backup failed",
txt_backup_remote_restore_invalid_response: "Invalid remote backup restore response",
txt_backup_remote_run_invalid_response: "Invalid remote backup run response",
txt_backup_settings_invalid_response: "Invalid backup settings response",
txt_backup_import_invalid_response: "Invalid backup import response",
txt_backup_destination: "Backup Destination",
txt_backup_protocol_webdav: "WebDAV",
txt_backup_protocol_e3: "E3",
txt_backup_recommend_group_webdav: "WebDAV",
txt_backup_recommend_group_s3: "S3",
txt_backup_destination_name_default_webdav: "WebDAV {index}",
txt_backup_destination_name_default_e3: "E3 {index}",
txt_backup_type: "Backup Type",
txt_backup_destination_reserved: "Reserved Slot",
txt_backup_time: "Backup Time",
txt_backup_timezone: "Timezone",
txt_backup_frequency: "Frequency",
txt_backup_frequency_daily: "Daily",
txt_backup_frequency_weekly: "Weekly",
txt_backup_frequency_monthly: "Monthly",
txt_backup_day_of_week: "Day of Week",
txt_backup_day_of_month: "Day of Month",
txt_backup_weekday_monday: "Monday",
txt_backup_weekday_tuesday: "Tuesday",
txt_backup_weekday_wednesday: "Wednesday",
txt_backup_weekday_thursday: "Thursday",
txt_backup_weekday_friday: "Friday",
txt_backup_weekday_saturday: "Saturday",
txt_backup_weekday_sunday: "Sunday",
txt_backup_retention_count: "Keep",
txt_backup_retention_count_suffix: "items",
txt_backup_retention_count_hint: "Leave empty to keep all backup files. New destinations default to 30.",
txt_backup_enable_schedule: "Enable automatic daily backup",
txt_backup_schedule_note: "The worker checks the schedule every 5 minutes and runs the backup as soon as the selected time window is reached.",
txt_backup_schedule_disabled: "Disabled",
txt_backup_schedule_status: "Schedule",
txt_backup_schedule_summary: "Daily at {time} ({timezone})",
txt_backup_schedule_empty: "No automatic backup plans are enabled yet.",
txt_backup_last_success: "Last Success",
txt_backup_last_target: "Last Target",
txt_backup_last_file: "Last File",
txt_backup_last_error_prefix: "Last Error",
txt_backup_none_yet: "No remote backup has completed yet",
txt_backup_not_configured: "Not configured",
txt_backup_never: "Never",
txt_backup_unknown_size: "Unknown size",
txt_backup_webdav_url: "WebDAV Server URL",
txt_backup_webdav_username: "WebDAV Username",
txt_backup_webdav_password: "WebDAV Password",
txt_backup_webdav_path: "Remote Folder",
txt_backup_e3_endpoint: "E3 Endpoint",
txt_backup_e3_bucket: "Bucket",
txt_backup_e3_region: "Region",
txt_backup_e3_access_key: "Access Key",
txt_backup_e3_secret_key: "Secret Key",
txt_backup_e3_path: "Remote Path",
txt_backup_reserved_name: "Reserved Provider Name",
txt_backup_reserved_notes: "Reserved Notes",
txt_backup_reserved_notes_placeholder: "Leave a note for the next destination type",
txt_backup_reserved_hint: "This slot is reserved for a future destination. You can save notes now, but automatic uploads stay disabled.",
txt_backup_file: "Backup File",
txt_backup_file_required: "Please select a backup file",
txt_backup_no_file_selected: "No backup file selected",
txt_backup_selected_file_name: "Selected file: {name}",
txt_backup_replace_confirm_title: "Replace Current Instance Data",
txt_backup_replace_confirm_message: "The current instance already contains data. Clear it and import the new backup?",
txt_backup_replace_confirm_message: "The current instance already contains data. Clear it and restore the selected backup?",
txt_backup_clear_and_import: "Clear and Import",
txt_backup_clear_and_restore: "Clear and Restore",
txt_access_count: "Access Count",
txt_accessed_count_times: "Accessed {count} times",
txt_actions: "Actions",
@@ -425,29 +581,185 @@ const zhCNOverrides: Record<string, string> = {
nav_admin_panel: '用户管理',
nav_account_settings: '账户设置',
nav_device_management: '设备管理',
nav_backup_strategy: '备份策略',
nav_backup_strategy: '备份中心',
nav_import_export: '导入导出',
backup_strategy_title: '备份策略',
backup_strategy_title: '备份中心',
backup_strategy_under_construction: '正在搭建中',
import_export_title: '导入导出',
import_export_under_construction: '正在搭建中',
txt_backup_export: '备份导出',
txt_backup_import: '备份导入',
txt_backup_export: '导出备份',
txt_backup_import: '还原',
txt_backup_export_description: '下载一个完整的实例备份 ZIP,手动保管即可。',
txt_backup_import_description: '上传之前导出的备份 ZIP,并恢复到全新实例空壳。',
txt_backup_import_description: '上传之前导出的备份 ZIP,并还原到当前实例。',
txt_backup_exporting: '正在导出...',
txt_backup_importing: '正在导入...',
txt_backup_importing: '正在还原...',
txt_backup_restoring: '正在还原...',
txt_backup_export_success: '备份已导出',
txt_backup_import_success_relogin: '备份已导入,请重新登录',
txt_backup_import_success_relogin: '备份已还原,请重新登录',
txt_backup_restore_success_relogin: '备份已还原,请重新登录',
txt_backup_export_failed: '备份导出失败',
txt_backup_import_failed: '备份导入失败',
txt_backup_import_failed: '备份还原失败',
txt_backup_restore_failed: '备份还原失败',
txt_backup_center_title: '实例备份',
txt_backup_center_description: '把本地导出和远程自动备份放在一起管理,既方便手动恢复,也能每天自动留一份。',
txt_backup_restore_note: '还原会覆盖当前实例;如果当前已有数据,系统会要求你确认“清空后还原”。',
txt_backup_manual: '手动备份',
txt_backup_manual_description: '现在就导出 ZIP,或者把之前导出的 ZIP 恢复到当前实例。',
txt_backup_destinations_title: '备份地点',
txt_backup_destinations_description: '把多个 WebDAV、E3 地点统一放在这里。左侧选一个,右侧编辑和浏览它。',
txt_backup_recommend_title: '推荐储存库',
txt_backup_recommend_open_signup: '前往注册',
txt_backup_recommend_open_signup_aff: '前往注册(含 AFF',
txt_backup_recommend_open_guide: '查看教程',
txt_backup_recommend_empty: '暂时没有推荐',
txt_backup_recommend_referral_label: '推荐码',
txt_backup_recommend_referral_note: '注册时填写可额外获得 5 GB,作者会收到 2 GB。',
txt_backup_recommend_infinicloud_summary: '只需邮箱即可注册。免费 20 GB;填写推荐码后总计 25 GB。',
txt_backup_recommend_infinicloud_step_1: '先用邮箱注册一个 InfiniCLOUD 账号。',
txt_backup_recommend_infinicloud_step_2_prefix: '进入',
txt_backup_recommend_infinicloud_step_2_suffix: ',然后开启 Turn on Apps Connection。',
txt_backup_recommend_infinicloud_step_3: 'Connection ID 用作 WebDAV 用户名,Apps Password 用作 WebDAV 密码。',
txt_backup_recommend_infinicloud_step_4: '在 My Page 最下面的 Referral Bonus 填入推荐码 2HC5E,可额外获得 5 GB。',
txt_backup_recommend_open_password: '密码设置',
txt_backup_recommend_open_storage: '打开储存连接',
txt_backup_recommend_koofr_summary: '只需邮箱即可注册使用。免费 10 GB,并且可以通过 WebDAV 接到 Google Drive、OneDrive、Dropbox。',
txt_backup_recommend_koofr_password_link: '密码设置',
txt_backup_recommend_koofr_storage_link: 'Storage',
txt_backup_recommend_koofr_step_1: '先用邮箱注册一个 Koofr 账号。',
txt_backup_recommend_koofr_step_2_prefix: '打开',
txt_backup_recommend_koofr_step_2_suffix: ',生成新的应用密码。注册邮箱用作 WebDAV 用户名,应用密码用作 WebDAV 密码。',
txt_backup_recommend_koofr_step_3: 'Koofr 自己的 WebDAV 地址是 https://app.koofr.net/dav/Koofr。',
txt_backup_recommend_koofr_step_4: 'Koofr 最方便的地方,是还能接 Google Drive、OneDrive、Dropbox 这三大云盘;免费用户最多能连接两个。',
txt_backup_recommend_koofr_step_5_prefix: '打开',
txt_backup_recommend_koofr_step_5_suffix: ',在左侧栏点击“连接”,选择你要连接的储存即可。',
txt_backup_recommend_koofr_dav_intro: '连接好储存后,账号和应用密码都不变,只需要切换 WebDAV 地址:',
txt_backup_recommend_koofr_dav_self: 'Koofr',
txt_backup_recommend_pcloud_summary: '只需邮箱即可注册。免费最高 10 GB,并且自带标准 WebDAV 访问。',
txt_backup_recommend_pcloud_step_1: '先用邮箱注册一个 pCloud 账号。',
txt_backup_recommend_pcloud_step_2: 'WebDAV 地址填写 https://webdav.pcloud.com/ 。',
txt_backup_recommend_pcloud_step_3: '注册邮箱用作 WebDAV 用户名,注册密码用作 WebDAV 密码。',
txt_backup_add_destination: '新增地点',
txt_backup_schedule_panel_title: '自动备份计划',
txt_backup_schedule_panel_note: '每个备份地点都可以单独配置自己的每日自动备份计划。',
txt_backup_scheduled_target: '当前计划目标',
txt_backup_destination_active_badge: '已启用计划',
txt_backup_destination_idle_badge: '未启用计划',
txt_backup_destination_last_success: '上次成功:{time}',
txt_backup_destination_never_run: '还没有成功执行过',
txt_backup_destination_detail_title: '地点详情',
txt_backup_destination_detail_note: '',
txt_backup_destination_name: '地点名称',
txt_backup_set_scheduled_target: '设为每日备份目标',
txt_backup_delete_destination: '删除',
txt_backup_destination_deleted: '备份地点已删除',
txt_backup_delete_destination_confirm_message: '删除备份地点“{name}”?此操作不可撤销。',
txt_backup_select_destination: '请先从左侧列表选择一个备份地点',
txt_backup_remote_save_first: '请先保存这个备份地点,再浏览它的远端备份文件',
txt_backup_automation: '自动备份',
txt_backup_automation_description: '选择备份地点,保存连接信息后,系统会按设定时间每天自动上传一份备份。',
txt_backup_settings_saved: '备份设置已保存',
txt_backup_settings_save_failed: '备份设置保存失败',
txt_backup_settings_load_failed: '备份设置加载失败',
txt_backup_save_settings: '保存设置',
txt_backup_saving: '正在保存...',
txt_backup_enable_action: '启用',
txt_backup_disable_action: '停用',
txt_backup_run_now: '立即执行远程备份',
txt_backup_run_manual: '手动执行',
txt_backup_running_now: '执行中...',
txt_backup_remote_run_success: '远程备份已完成',
txt_backup_remote_run_failed: '远程备份失败',
txt_backup_remote_title: '远端备份',
txt_backup_remote_note: '浏览已保存的备份地点,选择某个备份 ZIP 后可以下载,也可以直接还原。',
txt_backup_remote_saved_basis: '远端浏览使用的是“已保存”的备份地点配置,不会读取你当前未保存的表单内容。',
txt_backup_remote_refresh: '刷新',
txt_backup_remote_root: '根目录',
txt_backup_remote_up: '上一级',
txt_backup_remote_open: '打开',
txt_backup_remote_download: '下载',
txt_backup_remote_downloading: '下载中...',
txt_backup_remote_restore: '还原',
txt_backup_remote_loading: '正在读取远端备份...',
txt_backup_remote_cached_empty: '点击“刷新”后读取',
txt_backup_remote_empty: '这个目录下还没有备份文件',
txt_backup_remote_folder: '文件夹',
txt_backup_remote_unknown_time: '未知时间',
txt_backup_remote_current_path: '当前目录',
txt_backup_remote_load_failed: '读取远端备份失败',
txt_backup_remote_invalid_response: '远端备份响应无效',
txt_backup_remote_download_failed: '下载远端备份失败',
txt_backup_remote_delete_success: '远端备份已删除',
txt_backup_remote_delete_failed: '删除远端备份失败',
txt_backup_remote_delete_confirm_message: '删除备份文件“{name}”?此操作不可撤销。',
txt_backup_remote_deleting: '删除中...',
txt_backup_remote_restore_failed: '还原远端备份失败',
txt_backup_remote_restore_invalid_response: '远端备份还原响应无效',
txt_backup_remote_run_invalid_response: '远端备份执行响应无效',
txt_backup_settings_invalid_response: '备份设置响应无效',
txt_backup_import_invalid_response: '备份还原响应无效',
txt_backup_destination: '备份地点',
txt_backup_protocol_webdav: 'WebDAV',
txt_backup_protocol_e3: 'E3',
txt_backup_recommend_group_webdav: 'WebDAV',
txt_backup_recommend_group_s3: 'S3',
txt_backup_destination_name_default_webdav: 'WebDAV {index}',
txt_backup_destination_name_default_e3: 'E3 {index}',
txt_backup_type: '备份类型',
txt_backup_destination_reserved: '预留位置',
txt_backup_time: '备份时间',
txt_backup_timezone: '时区',
txt_backup_frequency: '备份频率',
txt_backup_frequency_daily: '每天',
txt_backup_frequency_weekly: '每周',
txt_backup_frequency_monthly: '每月',
txt_backup_day_of_week: '星期',
txt_backup_day_of_month: '日期',
txt_backup_weekday_monday: '周一',
txt_backup_weekday_tuesday: '周二',
txt_backup_weekday_wednesday: '周三',
txt_backup_weekday_thursday: '周四',
txt_backup_weekday_friday: '周五',
txt_backup_weekday_saturday: '周六',
txt_backup_weekday_sunday: '周日',
txt_backup_retention_count: '只保留',
txt_backup_retention_count_suffix: '个',
txt_backup_retention_count_hint: '留空表示不限,新建备份地点默认保留 30 个',
txt_backup_enable_schedule: '启用每日自动备份',
txt_backup_schedule_note: 'Worker 每 5 分钟检查一次计划,到达你设定的时间窗口后会尽快执行备份。',
txt_backup_schedule_disabled: '未启用',
txt_backup_schedule_status: '计划状态',
txt_backup_schedule_summary: '每天 {time}{timezone}',
txt_backup_schedule_empty: '还没有启用任何自动备份计划',
txt_backup_last_success: '上次成功时间',
txt_backup_last_target: '上次备份位置',
txt_backup_last_file: '上次备份文件',
txt_backup_last_error_prefix: '上次错误',
txt_backup_none_yet: '还没有成功完成过远程备份',
txt_backup_not_configured: '尚未配置',
txt_backup_never: '从未',
txt_backup_unknown_size: '大小未知',
txt_backup_webdav_url: 'WebDAV 服务地址',
txt_backup_webdav_username: 'WebDAV 用户名',
txt_backup_webdav_password: 'WebDAV 密码',
txt_backup_webdav_path: '远程目录',
txt_backup_e3_endpoint: 'E3 Endpoint',
txt_backup_e3_bucket: 'Bucket',
txt_backup_e3_region: 'Region',
txt_backup_e3_access_key: 'Access Key',
txt_backup_e3_secret_key: 'Secret Key',
txt_backup_e3_path: '远程路径',
txt_backup_reserved_name: '预留类型名称',
txt_backup_reserved_notes: '预留备注',
txt_backup_reserved_notes_placeholder: '给下一个备份地点先留个说明',
txt_backup_reserved_hint: '这个位置先预留给后续备份地点。你现在可以先保存备注,但自动上传不会启用。',
txt_backup_file: '备份文件',
txt_backup_file_required: '请选择备份文件',
txt_backup_no_file_selected: '尚未选择备份文件',
txt_backup_selected_file_name: '已选择文件:{name}',
txt_backup_replace_confirm_title: '替换当前实例数据',
txt_backup_replace_confirm_message: '当前实例里已经有数据。要先清空当前数据库和文件,再导入新的备份吗?',
txt_backup_replace_confirm_message: '当前实例里已经有数据。要先清空当前数据库和文件,再还原所选备份吗?',
txt_backup_clear_and_import: '清空后导入',
txt_backup_clear_and_restore: '清空后还原',
txt_sign_out: '退出登录',
txt_log_in: '登录',
txt_log_out: '退出',
+2
View File
@@ -13,6 +13,8 @@ export interface Profile {
email: string;
name: string;
key: string;
privateKey?: string | null;
publicKey?: string | null;
role: 'admin' | 'user';
[k: string]: unknown;
}