AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
style(settings): refine desktop backup retention copy and typography
tianma-if4d272855819e
diff --git a/apps/web/src/components/settings/DesktopScheduledBackupCard.tsx b/apps/web/src/components/settings/DesktopScheduledBackupCard.tsxindex 0d61ecf3..f0173af4 100644--- a/apps/web/src/components/settings/DesktopScheduledBackupCard.tsx+++ b/apps/web/src/components/settings/DesktopScheduledBackupCard.tsx@@ -1,5 +1,5 @@import { useEffect, useRef, useState } from "react";-import { FolderOpen, HardDriveDownload, Loader2, Upload } from "lucide-react";+import { ChevronRight, FolderOpen, HardDriveDownload, Loader2, Upload } from "lucide-react";import { useTranslation } from "react-i18next";import type { DesktopBackupConfig } from "@edgeever/shared";import { Button } from "@/components/ui/button";@@ -69,40 +69,65 @@ export const DesktopScheduledBackupCard = () => {<Button type="button" size="sm" variant="outline" disabled={restoreDisabled} onClick={() => restore()}><Upload className="h-4 w-4" />{t("desktopBackup.importButton")}</Button><Button type="button" size="sm" variant="ghost" disabled={saving} onClick={() => void attempt(() => bridge.backup("open-folder", { backupSetId: status.backupSetId }))}><FolderOpen className="h-4 w-4" />{t("desktopBackup.openFolder")}</Button></div>- <div className="grid gap-1.5 rounded-md bg-muted/50 p-3 text-sm" aria-live="polite" data-backup-status>- <p className="font-medium">{t("desktopBackup.lastSuccess", { time: date(status.lastSuccessAt) })}</p>- {status.task ? <p className="flex items-center gap-2"><Loader2 className="h-3.5 w-3.5 animate-spin" />{t(`desktopBackup.phases.${status.task.phase}`)}{status.task.total > 0 ? ` ${status.task.completed} / ${status.task.total}` : ""}</p> : status.lastCheck ? <p>{t(`desktopBackup.checkResults.${status.lastCheck.result}`)}</p> : null}+ <div className="grid gap-1.5 rounded-md bg-muted/40 p-3 text-xs" aria-live="polite" data-backup-status>+ <p className="font-medium text-slate-800">{t("desktopBackup.lastSuccess", { time: date(status.lastSuccessAt) })}</p>+ {status.task ? <p className="flex items-center gap-2"><Loader2 className="h-3.5 w-3.5 animate-spin" />{t(`desktopBackup.phases.${status.task.phase}`)}{status.task.total > 0 ? ` ${status.task.completed} / ${status.task.total}` : ""}</p> : status.lastCheck ? <p className="text-slate-700">{t(`desktopBackup.checkResults.${status.lastCheck.result}`)}</p> : null}<p className="text-muted-foreground">{t("desktopBackup.lastCheck", { time: status.lastCheck ? date(status.lastCheck.at) : t("desktopBackup.notChecked") })}</p><p className="text-muted-foreground">{status.config.enabled ? t("desktopBackup.nextDue", { time: status.nextDueAt ? date(status.nextDueAt) : t("desktopBackup.whenReady") }) : t("desktopBackup.autoOff")}</p>{error || status.error ? <p className="break-words text-destructive" role="alert">{error ?? describeDesktopBackupError(t, status.error)}</p> : null}{status.warning ? <p className="text-amber-700">{describeDesktopBackupError(t, status.warning)}</p> : null}</div>- <details className="border-t pt-4">- <summary className="cursor-pointer text-sm font-medium">{t("desktopBackup.settings")}</summary>- <div className="mt-4 grid gap-4">- <fieldset disabled={busy || saving} className="grid min-w-0 gap-4 disabled:opacity-60">- <label className="flex items-center justify-between gap-3 text-sm font-medium"><span>{t("desktopBackup.enable")}</span><Switch checked={config.enabled} onCheckedChange={(enabled) => patch({ enabled })} /></label>- <div className="grid gap-1.5"><span className="text-sm font-medium">{t("desktopBackup.directory")}</span><div className="flex min-w-0 items-center gap-2"><p className="min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-sm">{config.directory}/{status.backupSetId}</p><Button type="button" variant="outline" size="sm" onClick={() => void attempt(async () => { const directory = await bridge.backup("choose-directory", { backupSetId: status.backupSetId }); if (directory && scope.current === status.backupSetId) patch({ directory }); })}>{t("desktopBackup.choose")}</Button></div></div>+ <details className="group border-t pt-3">+ <summary className="flex cursor-pointer items-center gap-1.5 text-xs font-medium text-slate-700 select-none transition-colors hover:text-slate-900 list-none [&::-webkit-details-marker]:hidden">+ <ChevronRight className="h-3.5 w-3.5 text-slate-400 transition-transform duration-200 group-open:rotate-90" />+ <span>{t("desktopBackup.settings")}</span>+ </summary>+ <div className="mt-3.5 grid gap-3.5">+ <fieldset disabled={busy || saving} className="grid min-w-0 gap-3.5 disabled:opacity-60">+ <label className="flex items-center justify-between gap-3 text-xs font-medium text-slate-700">+ <span>{t("desktopBackup.enable")}</span>+ <Switch checked={config.enabled} onCheckedChange={(enabled) => patch({ enabled })} />+ </label>+ <div className="grid gap-1.5">+ <span className="text-xs font-medium text-slate-700">{t("desktopBackup.directory")}</span>+ <div className="flex min-w-0 items-center gap-2">+ <p className="min-w-0 flex-1 break-all rounded-md bg-muted px-2.5 py-1.5 font-mono text-xs text-muted-foreground">{config.directory}/{status.backupSetId}</p>+ <Button type="button" variant="outline" size="sm" className="h-8 text-xs font-normal" onClick={() => void attempt(async () => { const directory = await bridge.backup("choose-directory", { backupSetId: status.backupSetId }); if (directory && scope.current === status.backupSetId) patch({ directory }); })}>{t("desktopBackup.choose")}</Button>+ </div>+ </div><div className="grid grid-cols-2 gap-4">- <label className="grid gap-1.5 text-sm"><span className="font-medium">{t("desktopBackup.frequency")}</span><select className="h-9 rounded-md border border-input bg-background px-3" value={config.interval} onChange={(event) => patch({ interval: event.target.value as DesktopBackupConfig["interval"] })}>{(["daily", "weekly", "biweekly", "monthly"] as const).map((key) => <option key={key} value={key}>{t(`desktopBackup.intervals.${key}`)}</option>)}</select></label>- <label className="grid gap-1.5 text-sm"><span className="font-medium">{t("desktopBackup.retention")}</span><select className="h-9 rounded-md border border-input bg-background px-3" value={config.retention} onChange={(event) => patch({ retention: Number(event.target.value) as DesktopBackupConfig["retention"] })}>{([3, 5, 10, 20] as const).map((count) => <option key={count} value={count}>{t("desktopBackup.copies", { count })}</option>)}</select></label>+ <label className="grid gap-1.5 text-xs font-medium text-slate-700">+ <span>{t("desktopBackup.frequency")}</span>+ <select className="h-8 rounded-md border border-input bg-card px-2.5 text-xs text-slate-800 outline-none focus:border-slate-900 focus:ring-1 focus:ring-slate-900" value={config.interval} onChange={(event) => patch({ interval: event.target.value as DesktopBackupConfig["interval"] })}>+ {(["daily", "weekly", "biweekly", "monthly"] as const).map((key) => <option key={key} value={key}>{t(`desktopBackup.intervals.${key}`)}</option>)}+ </select>+ </label>+ <label className="grid gap-1.5 text-xs font-medium text-slate-700">+ <span>{t("desktopBackup.retention")}</span>+ <select className="h-8 rounded-md border border-input bg-card px-2.5 text-xs text-slate-800 outline-none focus:border-slate-900 focus:ring-1 focus:ring-slate-900" value={config.retention} onChange={(event) => patch({ retention: Number(event.target.value) as DesktopBackupConfig["retention"] })}>+ {([3, 5, 10, 20] as const).map((count) => <option key={count} value={count}>{t("desktopBackup.copies", { count })}</option>)}+ </select>+ </label></div><div className="grid gap-3">- <label className="flex items-center justify-between gap-3 text-sm font-medium"><span>{t("desktopBackup.encryption")}</span><Switch checked={config.encrypted} onCheckedChange={(encrypted) => patch({ encrypted })} /></label>- {config.encrypted && !status.secureStorageAvailable ? <p className="text-sm text-amber-700">{t("desktopBackup.secureUnavailable")}</p> : null}- {config.encrypted && status.passwordSet && !changePassword ? <div className="flex items-center justify-between gap-2 text-sm"><span className="text-muted-foreground">{t("desktopBackup.passwordSet")}</span><Button type="button" variant="ghost" size="sm" onClick={() => setChangePassword(true)}>{t("desktopBackup.changePassword")}</Button></div> : null}- {passwordNeeded ? <div className="grid gap-2"><Input type="password" autoComplete="new-password" aria-label={t("desktopBackup.password")} placeholder={t("desktopBackup.password")} value={password} onChange={(event) => setPassword(event.target.value)} /><Input type="password" autoComplete="new-password" aria-label={t("desktopBackup.confirmPassword")} placeholder={t("desktopBackup.confirmPassword")} value={confirmation} onChange={(event) => setConfirmation(event.target.value)} />{confirmation && password !== confirmation ? <p className="text-sm text-destructive" role="alert">{t("desktopBackup.passwordMismatch")}</p> : null}<p className="text-sm text-muted-foreground">{t("desktopBackup.passwordChangeNote")}</p></div> : null}+ <label className="flex items-center justify-between gap-3 text-xs font-medium text-slate-700">+ <span>{t("desktopBackup.encryption")}</span>+ <Switch checked={config.encrypted} onCheckedChange={(encrypted) => patch({ encrypted })} />+ </label>+ {config.encrypted && !status.secureStorageAvailable ? <p className="text-xs text-amber-700">{t("desktopBackup.secureUnavailable")}</p> : null}+ {config.encrypted && status.passwordSet && !changePassword ? <div className="flex items-center justify-between gap-2 text-xs"><span className="text-muted-foreground">{t("desktopBackup.passwordSet")}</span><Button type="button" variant="ghost" size="sm" className="h-7 text-xs font-normal" onClick={() => setChangePassword(true)}>{t("desktopBackup.changePassword")}</Button></div> : null}+ {passwordNeeded ? <div className="grid gap-2"><Input className="h-8 text-xs" type="password" autoComplete="new-password" aria-label={t("desktopBackup.password")} placeholder={t("desktopBackup.password")} value={password} onChange={(event) => setPassword(event.target.value)} /><Input className="h-8 text-xs" type="password" autoComplete="new-password" aria-label={t("desktopBackup.confirmPassword")} placeholder={t("desktopBackup.confirmPassword")} value={confirmation} onChange={(event) => setConfirmation(event.target.value)} />{confirmation && password !== confirmation ? <p className="text-xs text-destructive" role="alert">{t("desktopBackup.passwordMismatch")}</p> : null}<p className="text-xs text-muted-foreground">{t("desktopBackup.passwordChangeNote")}</p></div> : null}</div></fieldset>- <Button className="justify-self-start" size="sm" type="button" disabled={busy || saving || !dirty || !passwordValid} onClick={() => void attempt(async () => { await bridge.backup("save", { backupSetId: status.backupSetId, config, ...(passwordNeeded ? { password } : {}) }); if (scope.current === status.backupSetId) { setPassword(""); setConfirmation(""); setChangePassword(false); } })}>{t("common.save")}</Button>+ <Button className="h-8 justify-self-start text-xs font-normal" size="sm" type="button" disabled={busy || saving || !dirty || !passwordValid} onClick={() => void attempt(async () => { await bridge.backup("save", { backupSetId: status.backupSetId, config, ...(passwordNeeded ? { password } : {}) }); if (scope.current === status.backupSetId) { setPassword(""); setConfirmation(""); setChangePassword(false); } })}>{t("common.save")}</Button></div></details>- <section className="grid gap-3" aria-label={t("desktopBackup.history", { count: status.history.length })}>- <h3 className="text-sm font-medium">{t("desktopBackup.history", { count: status.history.length })}</h3>- {status.history.length ? <ul className="divide-y">{[...status.history].reverse().map((item) => <li key={item.name} className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2 py-3 first:pt-0 last:pb-0">- <div className="min-w-0 flex-1 basis-60 space-y-1"><p className="break-all text-sm">{item.name}</p><p className="text-sm text-muted-foreground">{date(item.completedAt)} · {(item.size / 1048576).toFixed(1)} MiB · {t(item.encrypted ? "desktopBackup.encrypted" : "desktopBackup.plain")}</p></div>- <div className="flex shrink-0 gap-1"><Button size="sm" variant="outline" disabled={restoreDisabled} onClick={() => restore(item.name)}>{t("desktopBackup.restore")}</Button><Button size="sm" variant="ghost" className="text-destructive hover:text-destructive" disabled={busy || saving} onClick={() => { setDeleteError(null); setDeleting(item.name); }}>{t("common.delete")}</Button></div>- </li>)}</ul> : <p className="text-sm text-muted-foreground">{t("desktopBackup.emptyHistory")}</p>}+ <section className="grid gap-2.5 border-t pt-3" aria-label={t("desktopBackup.history", { count: status.history.length })}>+ <h3 className="text-xs font-medium text-slate-700">{t("desktopBackup.history", { count: status.history.length })}</h3>+ {status.history.length ? <ul className="divide-y divide-slate-100">{[...status.history].reverse().map((item) => <li key={item.name} className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0">+ <div className="min-w-0 flex-1 basis-60 space-y-0.5"><p className="break-all font-mono text-xs text-slate-800">{item.name}</p><p className="text-xs text-muted-foreground">{date(item.completedAt)} · {(item.size / 1048576).toFixed(1)} MiB · {t(item.encrypted ? "desktopBackup.encrypted" : "desktopBackup.plain")}</p></div>+ <div className="flex shrink-0 gap-1"><Button size="sm" variant="outline" className="h-7 text-xs font-normal" disabled={restoreDisabled} onClick={() => restore(item.name)}>{t("desktopBackup.restore")}</Button><Button size="sm" variant="ghost" className="h-7 text-xs font-normal text-destructive hover:text-destructive" disabled={busy || saving} onClick={() => { setDeleteError(null); setDeleting(item.name); }}>{t("common.delete")}</Button></div>+ </li>)}</ul> : <p className="text-xs text-muted-foreground">{t("desktopBackup.emptyHistory")}</p>}</section></>}</DesktopBackupImport></CardContent>diff --git a/docs/desktop-scheduled-backup-design.md b/docs/desktop-scheduled-backup-design.mdindex d465e705..0e349ab9 100644--- a/docs/desktop-scheduled-backup-design.md+++ b/docs/desktop-scheduled-backup-design.md@@ -31,7 +31,7 @@ Desktop Settings → Data and backup uses one “Backup and restore” card inst| Automatic backups | Initially off; enabling a valid configuration schedules the first run || Frequency | Daily, weekly, every two weeks, or monthly; weekly by default || Destination | `EdgeEver Backups` under the OS Documents directory; change through the native directory picker |-| Retention | 3, 5, 10, or 20 archives; 5 by default |+| Keep recent | 3, 5, 10, or 20 archives; 5 by default || Password encryption | Optional and initially off; enabling it requires entering and confirming a separate backup password |The top actions are “Back up now,” “Restore from file,” and “Open folder.” Below them, show the last actual successful archive, latest check result, and next scheduled check or automatic-off state. Running tasks can be cancelled. Manual runs allow an editable filename and one-off plain/encrypted output, using the saved destination and retention without changing automatic settings; they remain available when scheduling is off.diff --git a/docs/desktop-scheduled-backup-design.zh-CN.md b/docs/desktop-scheduled-backup-design.zh-CN.mdindex c10c7d7f..0d9d2894 100644--- a/docs/desktop-scheduled-backup-design.zh-CN.md+++ b/docs/desktop-scheduled-backup-design.zh-CN.md@@ -31,7 +31,7 @@| 自动备份 | 首次关闭;用户开启且配置有效后安排首次备份 || 频率 | 每天、每周、每两周、每月;默认每周 || 保存目录 | 系统 Documents 目录下的 `EdgeEver Backups`,允许通过原生目录选择器更改 |-| 保留份数 | 3、5、10、20;默认 5 份 |+| 保留最近 | 3、5、10、20;默认 5 份 || 密码加密 | 可选,首次关闭;开启时输入并确认独立的备份密码 |顶部提供“立即备份”“从文件恢复”“打开文件夹”;其下显示上次实际成功备份、最近检查结果,以及下次计划检查或自动备份关闭状态。运行时可取消。手动备份可编辑文件名,并为本次选择明文或加密;沿用保存目录和保留规则,不修改自动备份配置,自动关闭时仍可使用。@@ -158,7 +158,7 @@ Linux 必须检查实际安全存储后端;`basic_text` 不能用于保存自2. 流式导出并写入目标目录中的唯一 `.part` 文件。启用加密时,ZIP 字节直接进入加密流,不在网盘目录留下明文中间文件。3. 校验实体计数、附件和最终源版本,完成 ZIP 及加密收尾,将文件刷新到磁盘。4. 在同一目录原子发布并持久化完成记录与上次成功时间。自动任务使用随机名称改名;手动命名使用排他硬链接创建,冲突或不支持时失败。-5. 清理超出保留份数的旧文件,发送一次轻量系统通知。+5. 清理超出保留数量的旧文件,发送一次轻量系统通知。任何发布前失败都取消流并删除本任务的临时文件,不更新成功时间,不执行历史清理。文件已发布但完成记录写入中断时,恢复流程先核对本任务记录和文件完整性,不把文件直接当成垃圾删除。diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 4b7c7aff..7717f393 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -2018,7 +2018,7 @@ export const enUS = {directory: "Backup folder",choose: "Choose…",frequency: "Frequency",- retention: "Keep",+ retention: "Keep recent",copies: "{{count}} backups",intervals: {daily: "Daily",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex f709b12f..602ae26e 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -2007,7 +2007,7 @@ export const ja = {directory: "保存先",choose: "選択…",frequency: "頻度",- retention: "保存数",+ retention: "直近を保持",copies: "{{count}} 件",intervals: {daily: "毎日",diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.tsindex 51b2cbe5..cfc8d17d 100644--- a/packages/shared/src/i18n/pl.ts+++ b/packages/shared/src/i18n/pl.ts@@ -2007,7 +2007,7 @@ export const pl = {directory: "Folder kopii",choose: "Wybierz…",frequency: "Częstotliwość",- retention: "Zachowaj",+ retention: "Zachowaj ostatnie",copies: "{{count}} kopii",intervals: {daily: "Codziennie",diff --git a/packages/shared/src/i18n/ru.ts b/packages/shared/src/i18n/ru.tsindex 2f35b7f3..958e204a 100644--- a/packages/shared/src/i18n/ru.ts+++ b/packages/shared/src/i18n/ru.ts@@ -2018,7 +2018,7 @@ export const ru = {directory: "Папка резервных копий",choose: "Выбрать…",frequency: "Частота",- retention: "Хранить",+ retention: "Хранить последние",copies: "Копий: {{count}}",intervals: {daily: "Ежедневно",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex cd79c4f8..df553138 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -2018,7 +2018,7 @@ export const zhCN = {directory: "备份目录",choose: "选择…",frequency: "备份频率",- retention: "保留份数",+ retention: "保留最近",copies: "{{count}} 份",intervals: {daily: "每天",@@ -2098,7 +2098,7 @@ export const zhCN = {backup_worker_failed: "后台任务已停止,请重试。",backup_file_required: "请重新选择备份文件。",backup_import_not_ready: "请等待归档检查完成。",- backup_invalid_configuration: "请检查备份频率、保留份数与保存目录。",+ backup_invalid_configuration: "请检查备份频率、保留设置与保存目录。",backup_failed: "备份失败,请检查网络与目录权限后重试。",backup_source_changed: "备份期间数据发生变化,请在停止编辑后重试。",backup_server_upgrade_required: "请升级 EdgeEver 服务端以使用自动备份。",