Update ImportExport.razor (#1046)

This commit is contained in:
Leendert de Borst
2026-05-04 11:48:55 +02:00
parent 9559fd521c
commit cd26b3e77a

View File

@@ -91,23 +91,22 @@
<Button OnClick="@(() => ShowExportConfirmation(ExportType.Csv))">@Localizer["ExportCsvButton"]</Button>
</div>
@*
DEBUG-only raw SQLite export. Stripped from release builds.
*@
#if DEBUG
<div class="flex items-center justify-between p-3 border-2 border-dashed border-yellow-400 dark:border-yellow-600 rounded-lg bg-yellow-50 dark:bg-yellow-900/20">
<div class="flex-1 min-w-0 mr-4">
<div class="flex items-center gap-2 mb-1">
<h4 class="text-sm font-semibold text-gray-900 dark:text-white">Export raw SQLite</h4>
<span class="px-1.5 py-0.5 text-xs font-medium text-yellow-800 dark:text-yellow-200 bg-yellow-200 dark:bg-yellow-800 rounded">DEBUG</span>
</div>
<p class="text-xs text-gray-600 dark:text-gray-300">
Downloads the unencrypted SQLite vault file as-is. Anyone with the file can read everything.
</p>
@* DEBUG-only raw SQLite export. *@
@if (IsDebugBuild)
{
<div class="flex items-center justify-between p-3 border-2 border-dashed border-yellow-400 dark:border-yellow-600 rounded-lg bg-yellow-50 dark:bg-yellow-900/20">
<div class="flex-1 min-w-0 mr-4">
<div class="flex items-center gap-2 mb-1">
<h4 class="text-sm font-semibold text-gray-900 dark:text-white">Export raw SQLite</h4>
<span class="px-1.5 py-0.5 text-xs font-medium text-yellow-800 dark:text-yellow-200 bg-yellow-200 dark:bg-yellow-800 rounded">DEBUG</span>
</div>
<Button OnClick="@ExportVaultSqlite">Download .sqlite</Button>
<p class="text-xs text-gray-600 dark:text-gray-300">
Downloads the unencrypted SQLite vault file as-is. Anyone with the file can read everything.
</p>
</div>
#endif
<Button OnClick="@ExportVaultSqlite">Download .sqlite</Button>
</div>
}
</div>
</div>
@@ -130,6 +129,13 @@
OnClose="@CloseExportPasswordModal" />
@code {
// Assign debug static flag for Razor markup check.
#if DEBUG
private static readonly bool IsDebugBuild = true;
#else
private static readonly bool IsDebugBuild = false;
#endif
private string _username = string.Empty;
private bool _showPasswordConfirmation;
private string _passwordError = string.Empty;
@@ -313,8 +319,7 @@
}
}
#if DEBUG
// DEBUG-only: downloads the in-memory SQLite vault in unencrypted form.
// Always defined so the markup binding compiles, only invoked when IsDebugBuild is true.
private async Task ExportVaultSqlite()
{
GlobalLoadingSpinner.Show("Exporting SQLite vault...");
@@ -334,7 +339,6 @@
GlobalLoadingSpinner.Hide();
}
}
#endif
private async Task ExportVaultAvux()
{