{ 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')); } e.target.value = null; }; reader.readAsText(file); }} />
{$i18n.t('Config')}
{$i18n.t('Import Config')}
{ document.getElementById('config-json-input').click(); }} type="button" >
{$i18n.t('Import')}
{$i18n.t('Export Config')}
{ const config = await exportConfig(localStorage.token); const blob = new Blob([JSON.stringify(config)], { type: 'application/json' }); saveAs(blob, `config-${Date.now()}.json`); }} type="button" >
{$i18n.t('Export')}
{#if $config?.features.enable_admin_export ?? true}
{$i18n.t('Database')}
{$i18n.t('Download Database')}
{ downloadDatabase(localStorage.token).catch((error) => { toast.error(`${error}`); }); }} type="button" >
{$i18n.t('Download')}
{$i18n.t('Export All Chats (All Users)')}
{ exportAllUserChats(); }} type="button" >
{$i18n.t('Export')}
{$i18n.t('Export Users')}
{ exportUsers(); }} type="button" >
{$i18n.t('Export')}
{/if}