feat(backup): add local backup export and restore
This commit is contained in:
1 parent
3db93307d0
commit
d089c62d2a
22 files changed
+738
-14
No files matched your search
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { FolderOpen } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import type { SyncCatalogItem, SyncSelection, SyncSnapshotCatalog } from "@/lib/backend/api";
|
||||
@@ -14,15 +15,21 @@ const props = defineProps<{
|
||||
mode: "upload" | "restore";
|
||||
catalog: SyncSnapshotCatalog | null;
|
||||
defaultIncludeSecrets?: boolean;
|
||||
secretsPassphraseAvailable?: boolean;
|
||||
showLocalExportPath?: boolean;
|
||||
localExportPath?: string;
|
||||
}>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:open": [value: boolean];
|
||||
confirm: [selection: SyncSelection];
|
||||
"choose-local-export-path": [];
|
||||
}>();
|
||||
|
||||
const selection = ref<SyncSelection>(emptySelection());
|
||||
const secretsPassphraseRequired = ref(false);
|
||||
const localExportPathRequired = ref(false);
|
||||
const isRestore = computed(() => props.mode === "restore");
|
||||
|
||||
const backupSettingsCategoryOrder: readonly BackupSettingsCategoryId[] = ["appearance", "editor", "formatter", "navigation", "data", "shortcuts", "snippets", "ai"];
|
||||
@@ -184,7 +191,7 @@ function resetFromCatalog() {
|
||||
pluginUiStorage: saved?.pluginUiStorage ?? (catalog.pluginUiStorageLocked ? undefined : catalog.pluginUiStorage),
|
||||
sidebarLayout: saved?.sidebarLayout ?? catalog.hasSidebarLayout,
|
||||
pinnedTreeNodeIds: saved?.pinnedTreeNodeIds ?? catalog.hasPinnedTreeNodeIds,
|
||||
includeSecrets: saved?.includeSecrets ?? (isRestore.value ? catalog.hasEncryptedSecrets : !!props.defaultIncludeSecrets),
|
||||
includeSecrets: props.secretsPassphraseAvailable === false ? false : (saved?.includeSecrets ?? (isRestore.value ? catalog.hasEncryptedSecrets : !!props.defaultIncludeSecrets)),
|
||||
syncCredentials: saved?.syncCredentials ?? (isRestore.value ? catalog.hasEncryptedSecrets : !!props.defaultIncludeSecrets),
|
||||
};
|
||||
if (selection.value.includeSecrets && !saved) onSecretsChanged();
|
||||
@@ -193,7 +200,11 @@ function resetFromCatalog() {
|
||||
watch(
|
||||
() => [props.open, props.catalog] as const,
|
||||
([open]) => {
|
||||
if (open) resetFromCatalog();
|
||||
if (open) {
|
||||
secretsPassphraseRequired.value = false;
|
||||
localExportPathRequired.value = false;
|
||||
resetFromCatalog();
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -202,6 +213,10 @@ function ids(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "tunn
|
||||
return selection.value[key] ?? [];
|
||||
}
|
||||
|
||||
function allSelected(key: "connections" | "tunnelProfiles", items: SyncCatalogItem[]) {
|
||||
return items.length > 0 && items.every((item) => ids(key).includes(item.id));
|
||||
}
|
||||
|
||||
function toggleId(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "tunnelSecrets" | "savedSqlFolders" | "savedSqlFiles" | "desktopSettings" | "editorSettings" | "aiConfigs", id: string) {
|
||||
const current = ids(key);
|
||||
selection.value[key] = current.includes(id) ? current.filter((item) => item !== id) : [...current, id];
|
||||
@@ -209,7 +224,8 @@ function toggleId(key: "connections" | "connectionSecrets" | "tunnelProfiles" |
|
||||
|
||||
function toggleAll(key: "connections" | "tunnelProfiles" | "savedSqlFolders" | "savedSqlFiles" | "desktopSettings" | "editorSettings" | "aiConfigs", items: SyncCatalogItem[]) {
|
||||
const current = ids(key);
|
||||
selection.value[key] = current.length === items.length ? [] : items.map((item) => item.id);
|
||||
const isAllSelected = items.length > 0 && items.every((item) => current.includes(item.id));
|
||||
selection.value[key] = isAllSelected ? [] : items.map((item) => item.id);
|
||||
}
|
||||
|
||||
function toggleSettingsCategory(category: BackupSettingsCategoryId) {
|
||||
@@ -254,7 +270,17 @@ function toggleAllAiConfigs() {
|
||||
toggleAll("aiConfigs", props.catalog?.aiConfigs ?? []);
|
||||
}
|
||||
|
||||
function onSecretsChanged() {
|
||||
function onSecretsChanged(event?: Event) {
|
||||
if (event) {
|
||||
const includeSecrets = (event.target as HTMLInputElement).checked;
|
||||
if (includeSecrets && props.secretsPassphraseAvailable === false) {
|
||||
selection.value.includeSecrets = false;
|
||||
secretsPassphraseRequired.value = true;
|
||||
return;
|
||||
}
|
||||
selection.value.includeSecrets = includeSecrets;
|
||||
secretsPassphraseRequired.value = false;
|
||||
}
|
||||
if (!selection.value.includeSecrets || !props.catalog) return;
|
||||
if (!selection.value.connectionSecrets?.length) selection.value.connectionSecrets = [...props.catalog.connectionSecrets];
|
||||
if (!selection.value.tunnelSecrets?.length) selection.value.tunnelSecrets = [...props.catalog.tunnelSecrets];
|
||||
@@ -267,12 +293,37 @@ function checked(key: "connections" | "connectionSecrets" | "tunnelProfiles" | "
|
||||
return ids(key).includes(id);
|
||||
}
|
||||
|
||||
function copySelection(): SyncSelection {
|
||||
const current = selection.value;
|
||||
return {
|
||||
connections: current.connections ? [...current.connections] : undefined,
|
||||
connectionSecrets: current.connectionSecrets ? [...current.connectionSecrets] : undefined,
|
||||
tunnelProfiles: current.tunnelProfiles ? [...current.tunnelProfiles] : undefined,
|
||||
tunnelSecrets: current.tunnelSecrets ? [...current.tunnelSecrets] : undefined,
|
||||
savedSqlFolders: current.savedSqlFolders ? [...current.savedSqlFolders] : undefined,
|
||||
savedSqlFiles: current.savedSqlFiles ? [...current.savedSqlFiles] : undefined,
|
||||
desktopSettings: current.desktopSettings ? [...current.desktopSettings] : undefined,
|
||||
editorSettings: current.editorSettings ? [...current.editorSettings] : undefined,
|
||||
aiConfigs: current.aiConfigs ? [...current.aiConfigs] : undefined,
|
||||
pluginUiStorage: current.pluginUiStorage?.map(({ pluginId, key, pluginName }) => ({ pluginId, key, pluginName })),
|
||||
sidebarLayout: current.sidebarLayout,
|
||||
pinnedTreeNodeIds: current.pinnedTreeNodeIds,
|
||||
includeSecrets: current.includeSecrets,
|
||||
syncCredentials: current.syncCredentials,
|
||||
};
|
||||
}
|
||||
|
||||
function confirmSelection() {
|
||||
if (props.showLocalExportPath && !props.localExportPath?.trim()) {
|
||||
localExportPathRequired.value = true;
|
||||
return;
|
||||
}
|
||||
localExportPathRequired.value = false;
|
||||
if (props.catalog) {
|
||||
selection.value.desktopSettings = selectedSettings(selection.value.desktopSettings, selectableDesktopSettings(props.catalog));
|
||||
selection.value.editorSettings = selectedSettings(selection.value.editorSettings, selectableEditorSettings(props.catalog));
|
||||
}
|
||||
emit("confirm", clonePluginData(selection.value));
|
||||
emit("confirm", clonePluginData(copySelection()));
|
||||
emit("update:open", false);
|
||||
}
|
||||
</script>
|
||||
@@ -290,7 +341,7 @@ function confirmSelection() {
|
||||
<div v-if="catalog" class="min-h-0 flex-1 space-y-2 overflow-y-auto px-5 py-4">
|
||||
<details open class="border-b pb-2">
|
||||
<summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">
|
||||
<input :checked="selection.connections?.length === catalog.connections.length" type="checkbox" class="size-4 accent-primary" @click.stop.prevent="toggleAll('connections', catalog.connections)" />
|
||||
<input :checked="allSelected('connections', catalog.connections)" type="checkbox" class="size-4 accent-primary" @click.stop.prevent="toggleAll('connections', catalog.connections)" />
|
||||
<span>{{ t("settings.syncSelectionConnections") }}</span>
|
||||
<span class="ml-auto text-xs text-muted-foreground">{{ selection.connections?.length ?? 0 }}/{{ catalog.connections.length }}</span>
|
||||
</summary>
|
||||
@@ -311,7 +362,7 @@ function confirmSelection() {
|
||||
|
||||
<details open class="border-b pb-2">
|
||||
<summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">
|
||||
<input :checked="selection.tunnelProfiles?.length === catalog.tunnelProfiles.length" type="checkbox" class="size-4 accent-primary" @click.stop.prevent="toggleAll('tunnelProfiles', catalog.tunnelProfiles)" />
|
||||
<input :checked="allSelected('tunnelProfiles', catalog.tunnelProfiles)" type="checkbox" class="size-4 accent-primary" @click.stop.prevent="toggleAll('tunnelProfiles', catalog.tunnelProfiles)" />
|
||||
<span>{{ t("settings.syncSelectionTunnels") }}</span>
|
||||
<span class="ml-auto text-xs text-muted-foreground">{{ selection.tunnelProfiles?.length ?? 0 }}/{{ catalog.tunnelProfiles.length }}</span>
|
||||
</summary>
|
||||
@@ -365,10 +416,13 @@ function confirmSelection() {
|
||||
|
||||
<details open class="border-b pb-2">
|
||||
<summary class="flex cursor-pointer list-none items-center gap-2 py-2 text-sm font-medium">
|
||||
<input v-model="selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @click.stop @change="onSecretsChanged" />
|
||||
<input :checked="selection.includeSecrets" type="checkbox" class="size-4 accent-primary" @click.stop @change="onSecretsChanged" />
|
||||
<span>{{ t("settings.syncSelectionEncrypted") }}</span>
|
||||
</summary>
|
||||
<div class="ml-6 space-y-2 pb-2">
|
||||
<p v-if="secretsPassphraseRequired" role="alert" class="text-xs text-destructive">
|
||||
{{ t("settings.localBackupSecretsPassphraseRequiredHint") }}
|
||||
</p>
|
||||
<label class="flex min-h-7 items-center gap-2 text-sm">
|
||||
<input v-model="selection.syncCredentials" :disabled="!selection.includeSecrets" type="checkbox" class="size-4 accent-primary" />
|
||||
<span>{{ t("settings.syncSelectionSyncCredentials") }}</span>
|
||||
@@ -423,6 +477,24 @@ function confirmSelection() {
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div v-if="showLocalExportPath" class="shrink-0 border-t px-5 py-3">
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="text-xs font-medium">{{ t("settings.localBackupPathLabel") }}</p>
|
||||
<p class="truncate text-xs text-muted-foreground">
|
||||
{{ localExportPath || t("settings.localBackupPathUnset") }}
|
||||
</p>
|
||||
</div>
|
||||
<Button type="button" variant="outline" size="sm" @click="emit('choose-local-export-path')">
|
||||
<FolderOpen class="mr-1 h-3.5 w-3.5" />
|
||||
{{ t("settings.localBackupChoosePath") }}
|
||||
</Button>
|
||||
</div>
|
||||
<p v-if="localExportPathRequired" role="alert" class="mt-2 text-xs text-destructive">
|
||||
{{ t("settings.localBackupPathRequired") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<DialogFooter class="mx-0 mb-0 shrink-0 border-t px-5 pb-4 pt-3">
|
||||
<Button variant="outline" @click="emit('update:open', false)">{{ t("settings.syncSelectionCancel") }}</Button>
|
||||
<Button :disabled="!catalog" @click="confirmSelection">{{ isRestore ? t("settings.syncSelectionRestoreAction") : t("settings.syncSelectionUploadAction") }}</Button>
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Filter,
|
||||
Globe,
|
||||
GripVertical,
|
||||
HardDrive,
|
||||
Loader2,
|
||||
Moon,
|
||||
PackageSearch,
|
||||
@@ -152,6 +153,9 @@ import {
|
||||
getAppSupportInfo,
|
||||
checkBackgroundImage,
|
||||
cloudSyncLocalCatalog,
|
||||
localBackupExport,
|
||||
localBackupImport,
|
||||
localBackupInspect,
|
||||
clearBackgroundImage,
|
||||
saveBackgroundImage,
|
||||
loadMaxAgentTurns,
|
||||
@@ -4277,7 +4281,14 @@ const webdavAutoUploadIntervalMinutes = ref(Number(localStorage.getItem("dbx-web
|
||||
const webdavBusy = ref<"" | "test" | "upload" | "download">("");
|
||||
const webdavMessage = ref("");
|
||||
const webdavError = ref(false);
|
||||
const syncMethodTab = ref<"webdav" | "snippet">("webdav");
|
||||
const localBackupSecretsPassphrase = ref("");
|
||||
const localBackupBusy = ref<"" | "export" | "import">("");
|
||||
const localBackupMessage = ref("");
|
||||
const localBackupError = ref(false);
|
||||
const localBackupPath = ref("");
|
||||
const localBackupDirectoryStorageKey = "dbx-local-backup-directory";
|
||||
const localBackupDirectory = ref(localStorage.getItem(localBackupDirectoryStorageKey) || "");
|
||||
const syncMethodTab = ref<"webdav" | "snippet" | "local">("webdav");
|
||||
const syncSelectionOpen = ref(false);
|
||||
const syncSelectionMode = ref<"upload" | "restore">("upload");
|
||||
const syncSelectionCatalog = ref<SyncSnapshotCatalog | null>(null);
|
||||
@@ -4303,6 +4314,7 @@ const pendingLegacyCleanupId = ref("");
|
||||
const snippetSyncSettingsLoading = ref(true);
|
||||
|
||||
const webdavReady = computed(() => !!webdavEndpoint.value.trim() && !webdavBusy.value);
|
||||
const localBackupCanIncludeSecrets = computed(() => !!localBackupSecretsPassphrase.value.trim());
|
||||
const snippetReady = computed(() => !snippetSyncSettingsLoading.value && !snippetBusy.value && (snippetProvider.value !== "gitlab" || (!snippetInstanceError.value && snippetInstanceUrl.value === activeSnippetInstanceUrl.value)) && (!!snippetToken.value.trim() || snippetHasSavedToken.value));
|
||||
const snippetUploadReady = computed(() => snippetReady.value && !!snippetPassphrase.value.trim());
|
||||
// Legacy plaintext snippets have no outer encryption password. Let the
|
||||
@@ -4622,7 +4634,117 @@ async function downloadWebDavSnapshot() {
|
||||
});
|
||||
}
|
||||
|
||||
async function runLocalBackupAction(kind: "export" | "import", action: () => Promise<string>) {
|
||||
localBackupBusy.value = kind;
|
||||
localBackupMessage.value = "";
|
||||
localBackupError.value = false;
|
||||
try {
|
||||
localBackupMessage.value = await action();
|
||||
} catch (error: any) {
|
||||
localBackupMessage.value = error?.message || String(error);
|
||||
localBackupError.value = true;
|
||||
} finally {
|
||||
localBackupBusy.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
function localBackupFileName() {
|
||||
const now = new Date();
|
||||
const twoDigits = (value: number) => String(value).padStart(2, "0");
|
||||
const timestamp = `${now.getFullYear()}-${twoDigits(now.getMonth() + 1)}-${twoDigits(now.getDate())}_${twoDigits(now.getHours())}-${twoDigits(now.getMinutes())}-${twoDigits(now.getSeconds())}-${String(now.getMilliseconds()).padStart(3, "0")}`;
|
||||
return `dbx-backup_${timestamp}.dbxbackup`;
|
||||
}
|
||||
|
||||
async function localBackupPathInDirectory(directory: string) {
|
||||
const { join } = await import("@tauri-apps/api/path");
|
||||
return join(directory, localBackupFileName());
|
||||
}
|
||||
|
||||
async function chooseLocalBackupExport() {
|
||||
await runLocalBackupAction("export", async () => {
|
||||
localBackupPath.value = localBackupDirectory.value ? await localBackupPathInDirectory(localBackupDirectory.value) : "";
|
||||
syncSelectionCatalog.value = await cloudSyncLocalCatalog(settingsStore.editorSettings);
|
||||
syncSelectionMode.value = "upload";
|
||||
syncSelectionOpen.value = true;
|
||||
return "";
|
||||
});
|
||||
}
|
||||
|
||||
async function chooseLocalBackupPath() {
|
||||
await runLocalBackupAction("export", async () => {
|
||||
const { save } = await import("@tauri-apps/plugin-dialog");
|
||||
const path = await save({
|
||||
title: t("settings.localBackupExportTitle"),
|
||||
defaultPath: localBackupPath.value || localBackupFileName(),
|
||||
filters: [{ name: t("settings.localBackupFileType"), extensions: ["dbxbackup", "zip"] }],
|
||||
});
|
||||
if (path) {
|
||||
const { dirname } = await import("@tauri-apps/api/path");
|
||||
localBackupPath.value = path;
|
||||
localBackupDirectory.value = await dirname(path);
|
||||
localStorage.setItem(localBackupDirectoryStorageKey, localBackupDirectory.value);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
}
|
||||
|
||||
async function chooseLocalBackupImport() {
|
||||
await runLocalBackupAction("import", async () => {
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({
|
||||
title: t("settings.localBackupImportTitle"),
|
||||
multiple: false,
|
||||
filters: [{ name: t("settings.localBackupFileType"), extensions: ["dbxbackup", "zip"] }],
|
||||
});
|
||||
if (typeof selected !== "string" || !selected) return "";
|
||||
localBackupPath.value = selected;
|
||||
const catalog = await localBackupInspect(selected, localBackupSecretsPassphrase.value || undefined);
|
||||
if (!localBackupCanIncludeSecrets.value && catalog.hasEncryptedSecrets) {
|
||||
catalog.selection = {
|
||||
...(catalog.selection ?? {}),
|
||||
connectionSecrets: [],
|
||||
tunnelSecrets: [],
|
||||
aiConfigs: [],
|
||||
pluginUiStorage: [],
|
||||
includeSecrets: false,
|
||||
syncCredentials: false,
|
||||
};
|
||||
}
|
||||
syncSelectionCatalog.value = catalog;
|
||||
syncSelectionMode.value = "restore";
|
||||
syncSelectionOpen.value = true;
|
||||
return "";
|
||||
});
|
||||
}
|
||||
|
||||
async function confirmSyncSelection(selection: SyncSelection) {
|
||||
if (syncMethodTab.value === "local") {
|
||||
await nextTick();
|
||||
await runLocalBackupAction(syncSelectionMode.value === "upload" ? "export" : "import", async () => {
|
||||
if (selection.includeSecrets && !localBackupCanIncludeSecrets.value) {
|
||||
throw new Error(t("settings.localBackupPassphraseRequired"));
|
||||
}
|
||||
if (syncSelectionMode.value === "upload") {
|
||||
if (!localBackupPath.value) throw new Error(t("settings.localBackupPathRequired"));
|
||||
const summary = await localBackupExport(localBackupPath.value, settingsStore.editorSettings, selection.includeSecrets ? localBackupSecretsPassphrase.value : undefined, selection);
|
||||
return t("settings.localBackupExportSuccess", { bytes: summary.bytes, path: localBackupPath.value });
|
||||
}
|
||||
|
||||
const result = await localBackupImport(localBackupPath.value, selection.includeSecrets ? localBackupSecretsPassphrase.value : undefined, selection.includeSecrets, selection);
|
||||
if (result.editorSettings && typeof result.editorSettings === "object") settingsStore.updateEditorSettings(result.editorSettings as any);
|
||||
await settingsStore.updateDesktopSettings(result.desktopSettings);
|
||||
await connectionStore.initFromDisk();
|
||||
await savedSqlStore.initFromStorage();
|
||||
await tunnelProfileStore.refresh();
|
||||
await settingsStore.reloadAiConfigs();
|
||||
let message = t("settings.localBackupImportSuccess", { path: localBackupPath.value });
|
||||
if (result.applySummary.encryptedSecretsPresent && !result.applySummary.secretsApplied) message += ` ${t("settings.syncSecretsSkipped")}`;
|
||||
if (result.applySummary.secretsApplied) message += ` ${t("settings.syncSecretsApplied")}`;
|
||||
return message;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (syncMethodTab.value === "snippet") {
|
||||
if (syncSelectionMode.value === "upload") {
|
||||
snippetIncludeSecrets.value = selection.includeSecrets;
|
||||
@@ -9139,9 +9261,10 @@ LIMIT 100;</pre
|
||||
|
||||
<section v-else-if="activeSettingsTab === 'sync'" data-settings-search-id="sync" :class="['py-2', settingsSearchTargetClass('sync')]">
|
||||
<Tabs v-model="syncMethodTab" class="w-full">
|
||||
<TabsList v-if="!isWeb" class="grid w-full grid-cols-2">
|
||||
<TabsList v-if="!isWeb" class="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="webdav">WebDAV</TabsTrigger>
|
||||
<TabsTrigger value="snippet">{{ t("settings.syncSnippetTitle") }}</TabsTrigger>
|
||||
<TabsTrigger value="local">{{ t("settings.localBackupTitle") }}</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="webdav" data-settings-search-id="sync-webdav" :class="['mt-5 space-y-5', settingsSearchTargetClass('sync-webdav')]">
|
||||
@@ -9368,9 +9491,46 @@ LIMIT 100;</pre
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent v-if="!isWeb" value="local" data-settings-search-id="sync-local" :class="['mt-5 space-y-5', settingsSearchTargetClass('sync-local')]">
|
||||
<div class="space-y-1">
|
||||
<div class="flex items-center gap-2 text-sm font-medium">
|
||||
<HardDrive class="h-4 w-4 text-muted-foreground" />
|
||||
{{ t("settings.localBackupTitle") }}
|
||||
</div>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
{{ t("settings.localBackupDescription") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 rounded-md border p-4 md:grid-cols-2">
|
||||
<div class="space-y-2 md:col-span-2">
|
||||
<Label for="local-backup-secrets-passphrase">{{ t("settings.syncSecretsPassphrase") }}</Label>
|
||||
<PasswordInput id="local-backup-secrets-passphrase" v-model="localBackupSecretsPassphrase" autocomplete="new-password" />
|
||||
<p class="text-xs text-muted-foreground">
|
||||
{{ t("settings.localBackupPassphraseDescription") }}
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="localBackupMessage" class="text-xs md:col-span-2" :class="localBackupError ? 'text-destructive' : 'text-green-600 dark:text-green-400'">
|
||||
{{ localBackupMessage }}
|
||||
</div>
|
||||
<div class="flex flex-wrap justify-end gap-2 md:col-span-2">
|
||||
<Button variant="outline" size="sm" :disabled="!!localBackupBusy" @click="chooseLocalBackupImport">
|
||||
<Loader2 v-if="localBackupBusy === 'import'" class="mr-1 h-3 w-3 animate-spin" />
|
||||
<Download v-else class="mr-1 h-3 w-3" />
|
||||
{{ t("settings.localBackupImport") }}
|
||||
</Button>
|
||||
<Button size="sm" :disabled="!!localBackupBusy" @click="chooseLocalBackupExport">
|
||||
<Loader2 v-if="localBackupBusy === 'export'" class="mr-1 h-3 w-3 animate-spin" />
|
||||
<Upload v-else class="mr-1 h-3 w-3" />
|
||||
{{ t("settings.localBackupExport") }}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
<div class="settings-item mt-5 space-y-3 rounded-md border bg-muted/20 px-3 py-3">
|
||||
<div v-if="syncMethodTab !== 'local'" class="settings-item mt-5 space-y-3 rounded-md border bg-muted/20 px-3 py-3">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div class="space-y-1">
|
||||
<Label for="sync-secrets">{{ t("settings.syncSecrets") }}</Label>
|
||||
@@ -9405,7 +9565,17 @@ LIMIT 100;</pre
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<CloudSyncSelectionDialog v-model:open="syncSelectionOpen" :mode="syncSelectionMode" :catalog="syncSelectionCatalog" :default-include-secrets="syncMethodTab === 'snippet' ? snippetIncludeSecrets : webdavSyncSecrets" @confirm="confirmSyncSelection" />
|
||||
<CloudSyncSelectionDialog
|
||||
v-model:open="syncSelectionOpen"
|
||||
:mode="syncSelectionMode"
|
||||
:catalog="syncSelectionCatalog"
|
||||
:default-include-secrets="syncMethodTab === 'snippet' ? snippetIncludeSecrets : syncMethodTab === 'local' ? localBackupCanIncludeSecrets : webdavSyncSecrets"
|
||||
:secrets-passphrase-available="syncMethodTab !== 'local' || localBackupCanIncludeSecrets"
|
||||
:show-local-export-path="syncMethodTab === 'local' && syncSelectionMode === 'upload'"
|
||||
:local-export-path="localBackupPath"
|
||||
@choose-local-export-path="chooseLocalBackupPath"
|
||||
@confirm="confirmSyncSelection"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<!-- AI Settings Tab -->
|
||||
|
||||
Reference in new issue
Block a user