Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Feat: backup download frontend and locales
Lorinc936966d2afe695b
diff --git a/apps/client/src/translations/ar/translation.json b/apps/client/src/translations/ar/translation.jsonindex 70c3c2f737..1e78b26f02 100644--- a/apps/client/src/translations/ar/translation.json+++ b/apps/client/src/translations/ar/translation.json@@ -626,7 +626,8 @@"date-and-time": "التاريخ والوقت","no_backup_yet": "لايوجد نسخة احتياطية لحد الان","enable_daily_backup": "تمكين النسخ الاحتياطي اليومي",- "backup_database_now": "نسخ اختياطي لقاعدة البيانات الان"+ "backup_database_now": "نسخ اختياطي لقاعدة البيانات الان",+ "download": "تنزيل"},"etapi": {"created": "تم الأنشاء",diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 27891a02ab..9aeddac20a 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1381,7 +1381,8 @@"date-and-time": "Date & time","path": "Path","database_backed_up_to": "Database has been backed up to {{backupFilePath}}",- "no_backup_yet": "no backup yet"+ "no_backup_yet": "no backup yet",+ "download": "Download"},"etapi": {"title": "ETAPI",diff --git a/apps/client/src/translations/es/translation.json b/apps/client/src/translations/es/translation.jsonindex 3756ba8590..800d71d32c 100644--- a/apps/client/src/translations/es/translation.json+++ b/apps/client/src/translations/es/translation.json@@ -1332,7 +1332,8 @@"date-and-time": "Fecha y hora","path": "Ruta","database_backed_up_to": "Se ha realizado una copia de seguridad de la base de datos en {{backupFilePath}}",- "no_backup_yet": "no hay copia de seguridad todavía"+ "no_backup_yet": "no hay copia de seguridad todavía",+ "download": "Descargar"},"etapi": {"title": "ETAPI",diff --git a/apps/client/src/widgets/type_widgets/options/backup.tsx b/apps/client/src/widgets/type_widgets/options/backup.tsxindex 2f1a2d63ba..5d5a89d072 100644--- a/apps/client/src/widgets/type_widgets/options/backup.tsx+++ b/apps/client/src/widgets/type_widgets/options/backup.tsx@@ -1,15 +1,16 @@import { BackupDatabaseNowResponse, DatabaseBackup } from "@triliumnext/commons";+import { useCallback, useEffect, useState } from "preact/hooks";+import { t } from "../../../services/i18n";import server from "../../../services/server";import toast from "../../../services/toast";+import { formatDateTime } from "../../../utils/formatters";import Button from "../../react/Button";import FormCheckbox from "../../react/FormCheckbox";import { FormMultiGroup } from "../../react/FormGroup";import FormText from "../../react/FormText";import { useTriliumOptionBool } from "../../react/hooks";import OptionsSection from "./components/OptionsSection";-import { useCallback, useEffect, useState } from "preact/hooks";-import { formatDateTime } from "../../../utils/formatters";export default function BackupSettings() {const [ backups, setBackups ] = useState<DatabaseBackup[]>([]);@@ -35,7 +36,7 @@ export default function BackupSettings() {<BackupNow refreshCallback={refreshBackups} /><BackupList backups={backups} /></>- )+ );}export function AutomaticBackup() {@@ -67,7 +68,7 @@ export function AutomaticBackup() {<FormText>{t("backup.backup_recommendation")}</FormText></OptionsSection>- )+ );}export function BackupNow({ refreshCallback }: { refreshCallback: () => void }) {@@ -82,7 +83,7 @@ export function BackupNow({ refreshCallback }: { refreshCallback: () => void })}}/></OptionsSection>- )+ );}export function BackupList({ backups }: { backups: DatabaseBackup[] }) {@@ -92,11 +93,13 @@ export function BackupList({ backups }: { backups: DatabaseBackup[] }) {<colgroup><col width="33%" /><col />+ <col width="1%" /></colgroup><thead><tr><th>{t("backup.date-and-time")}</th><th>{t("backup.path")}</th>+ <th /></tr></thead><tbody>@@ -105,15 +108,20 @@ export function BackupList({ backups }: { backups: DatabaseBackup[] }) {<tr><td>{mtime ? formatDateTime(mtime) : "-"}</td><td className="selectable-text">{filePath}</td>+ <td>+ <a href={`api/database/backup/download?filePath=${encodeURIComponent(filePath)}`} download>+ <Button text={t("backup.download")} />+ </a>+ </td></tr>))) : (<tr>- <td className="empty-table-placeholder" colspan={2}>{t("backup.no_backup_yet")}</td>+ <td className="empty-table-placeholder" colspan={3}>{t("backup.no_backup_yet")}</td></tr>)}</tbody></table></OptionsSection>- );-}\ No newline at end of file+ );+}