From f364b2d205460dc1b0daa02ab7601fbe9dd62342 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 16 Feb 2026 02:05:19 -0600 Subject: [PATCH] refac --- .../components/admin/Settings/Database.svelte | 275 +++++++----------- 1 file changed, 105 insertions(+), 170 deletions(-) diff --git a/src/lib/components/admin/Settings/Database.svelte b/src/lib/components/admin/Settings/Database.svelte index 0baeb78e6c..8cc314661f 100644 --- a/src/lib/components/admin/Settings/Database.svelte +++ b/src/lib/components/admin/Settings/Database.svelte @@ -49,188 +49,123 @@ }); -
{ - saveHandler(); - }} -> -
-
-
{$i18n.t('Database')}
+
+
+ { + const file = e.target.files[0]; + const reader = new FileReader(); - { - const file = e.target.files[0]; - const reader = new FileReader(); - - reader.onload = async (e) => { - const res = await importConfig(localStorage.token, JSON.parse(e.target.result)).catch( - (error) => { - toast.error(`${error}`); - } - ); - - if (res) { - toast.success($i18n.t('Config imported successfully')); + reader.onload = async (e) => { + const res = await importConfig(localStorage.token, JSON.parse(e.target.result)).catch( + (error) => { + toast.error(`${error}`); } - e.target.value = null; - }; + ); - reader.readAsText(file); - }} - /> + if (res) { + toast.success($i18n.t('Config imported successfully')); + } + e.target.value = null; + }; - + reader.readAsText(file); + }} + /> - - -
- - {#if $config?.features.enable_admin_export ?? true} -
- +
+
{$i18n.t('Config')}
+
+
+
{$i18n.t('Import Config')}
+
- - - - {/if} +
+
+
{$i18n.t('Export Config')}
+ +
+
+ + {#if $config?.features.enable_admin_export ?? true} +
+
{$i18n.t('Database')}
+ +
+
+
{$i18n.t('Download Database')}
+ +
+
+ +
+
+
{$i18n.t('Export All Chats (All Users)')}
+ +
+
+ +
+
+
{$i18n.t('Export Users')}
+ +
+
+
+ {/if}
- +