add database backup and restore admin page
Some checks failed
deploy / deploy (push) Has been cancelled
Some checks failed
deploy / deploy (push) Has been cancelled
- SQLCipher-encrypted backup creation via VACUUM INTO - Backup history with auto-pruning (keeps last 5) - Pre-restore automatic backup for safety - Restore from history or uploaded file - Stats display with table breakdown - Download hook for client-side file download - SECRET_KEY_DB config for encryption at rest Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5158,6 +5158,17 @@
|
||||
color: var(--t-status-error, oklch(0.6 0.2 25));
|
||||
}
|
||||
|
||||
.admin-btn-danger {
|
||||
background: oklch(0.55 0.2 25);
|
||||
border-color: oklch(0.55 0.2 25);
|
||||
color: white;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: oklch(0.5 0.22 25);
|
||||
border-color: oklch(0.5 0.22 25);
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Provider group headings ── */
|
||||
|
||||
.card-radio-group-heading {
|
||||
@@ -5840,4 +5851,269 @@
|
||||
.sm\:scale-100 { scale: 1; }
|
||||
}
|
||||
|
||||
/* ── Backup page ── */
|
||||
|
||||
.admin-backup {
|
||||
max-width: 48rem;
|
||||
}
|
||||
|
||||
.admin-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--t-primary);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.admin-error {
|
||||
color: var(--admin-error);
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.admin-table-compact {
|
||||
font-size: 0.8125rem;
|
||||
|
||||
th, td {
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.backup-tables {
|
||||
margin-top: 1rem;
|
||||
max-height: 20rem;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--t-border-subtle);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.backup-tables .admin-table {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.backup-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.backup-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.backup-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 0.625rem 0.875rem;
|
||||
background: var(--t-surface-raised);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.backup-item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.backup-item-date {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.backup-item-meta {
|
||||
font-size: 0.75rem;
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
|
||||
.backup-item-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.backup-item-confirm {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--admin-text-muted);
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.backup-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 1rem;
|
||||
background: var(--t-surface-raised);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.backup-progress-text {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.backup-progress-hint {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
|
||||
.backup-dropzone {
|
||||
border: 2px dashed var(--t-border-subtle);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
transition: border-color 0.15s, background-color 0.15s;
|
||||
color: var(--admin-text-muted);
|
||||
|
||||
&:hover, &.phx-drop-target {
|
||||
border-color: var(--t-primary);
|
||||
background: oklch(from var(--t-primary) l c h / 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.backup-dropzone-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.backup-dropzone-link {
|
||||
color: var(--t-primary);
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.backup-upload-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 0.625rem 0.875rem;
|
||||
background: var(--t-surface-raised);
|
||||
border-radius: var(--radius-md);
|
||||
margin-top: 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
|
||||
progress {
|
||||
flex: 1;
|
||||
height: 0.375rem;
|
||||
border-radius: 9999px;
|
||||
overflow: hidden;
|
||||
background: var(--t-surface-inset);
|
||||
|
||||
&::-webkit-progress-bar {
|
||||
background: var(--t-surface-inset);
|
||||
}
|
||||
|
||||
&::-webkit-progress-value {
|
||||
background: var(--t-primary);
|
||||
}
|
||||
|
||||
&::-moz-progress-bar {
|
||||
background: var(--t-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.backup-comparison {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.backup-comparison-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.backup-comparison-col {
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--t-surface-raised);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.backup-comparison-label {
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--admin-text-muted);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.backup-comparison-arrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 1.5rem;
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
|
||||
.backup-comparison-stats {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.8125rem;
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
dt {
|
||||
color: var(--admin-text-muted);
|
||||
}
|
||||
|
||||
dd {
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
}
|
||||
|
||||
.backup-validation {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.8125rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.backup-validation-ok {
|
||||
background: oklch(0.95 0.1 145);
|
||||
color: oklch(0.35 0.15 145);
|
||||
}
|
||||
|
||||
.backup-validation-error {
|
||||
background: oklch(0.95 0.05 25);
|
||||
color: oklch(0.35 0.1 25);
|
||||
}
|
||||
|
||||
.backup-warning {
|
||||
padding: 0.75rem 1rem;
|
||||
background: oklch(0.96 0.03 60);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
color: oklch(0.35 0.1 60);
|
||||
|
||||
p {
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
} /* @layer admin */
|
||||
|
||||
Reference in New Issue
Block a user