feat: native save + auto-backup + folder customization + attachments + UX bundle

- File: native Save As dialog via Bridge.saveFile (replaces WebView2
  browser download popup) for encrypted JSON + CSV exports.
- Auto-backup: silent periodic encrypted JSON to a chosen folder,
  user-set interval + retention, separate DPAPI-stored password, runs
  5s after unlock if due. New file/* bridge cmds (folder/pick,
  file/write, file/listMatch, file/delete).
- Folders: per-folder color + icon (8-swatch palette, 8 icon presets),
  drag-reorder via HTML5 DnD with insert-line indicators, edit pencil
  on hover. New POST /folders/reorder + PUT /folders/{name}. Folder
  chip on cards inherits custom icon + color.
- Recently used: vault_entries.accessed_at + POST /entries/{id}/touch
  (debounced 2s), sidebar Tools entry showing top-10 by accessed_at.
- Encrypted attachments: per-entry file storage (5MB cap), AES-GCM
  with vault key, native Save As download, paperclip upload in
  slideover. New entry_attachments table + PM.Handler.Attachments.
- Password expiry: vault_entries.password_changed_at (conditional bump
  via SQL CASE only when ciphertext differs), passwordExpiryDays
  setting, "Aged" badge on cards + matching Filters chip.
- Recovery: Print button on generated code modal (A4 printable sheet
  via @media print, code in 32px monospace + instructions).
- Audit log viewer (sidebar Tools, GET /audit with pagination cursor).
- Plaintext CSV export + Filters dropdown with 9 predicates.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 23:12:06 +01:00
parent 63fac5b3b7
commit fa7ea191be
13 changed files with 3927 additions and 1378 deletions
+373
View File
@@ -537,6 +537,12 @@ input[type="range"]::-webkit-slider-thumb {
background: var(--accent-soft);
box-shadow: inset 0 0 0 2px var(--accent);
}
/* Folder reorder: insertion line above or below the hovered item. */
.nav-item.drop-before { box-shadow: inset 0 2px 0 0 var(--accent); }
.nav-item.drop-after { box-shadow: inset 0 -2px 0 0 var(--accent); }
.nav-item.is-dragging { opacity: 0.4; }
.nav-item[draggable="true"] { cursor: grab; }
.nav-item[draggable="true"]:active { cursor: grabbing; }
/* ---- 8. MAIN --------------------------------------------- */
@@ -1055,6 +1061,12 @@ input[type="range"]::-webkit-slider-thumb {
background: var(--accent-soft);
font-weight: 600;
}
.entry-chip.is-aged {
color: #b45309;
background: rgba(245, 158, 11, 0.15);
font-weight: 600;
}
.entry-chip.is-aged svg { stroke: #b45309; }
/* TOTP live-code panel (inside slide-over Two-factor field) */
.totp-panel {
@@ -1464,6 +1476,183 @@ input[type="range"]::-webkit-slider-thumb {
}
.so-custom-add .btn { padding: 4px 10px; font-size: 12px; }
/* ---- Audit log viewer -------------------------------- */
.entry-grid.is-audit {
display: flex;
flex-direction: column;
gap: 10px;
}
.audit-loading, .audit-empty {
color: var(--text-dim);
padding: 24px;
text-align: center;
font-size: 13px;
}
.audit-header {
display: flex; gap: 8px;
align-items: center;
}
.audit-search {
flex: 1;
padding: 6px 12px;
background: var(--bg-elev);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--text);
font-size: 13px;
}
.audit-search:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.audit-note {
margin: 0;
font-size: 11px;
color: var(--text-faint);
font-style: italic;
}
.audit-list {
display: flex;
flex-direction: column;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg-elev);
max-height: 70vh;
overflow-y: auto;
}
.audit-row {
display: grid;
grid-template-columns: 160px 1fr 120px;
gap: 12px;
padding: 8px 14px;
font-size: 12px;
border-bottom: 1px solid var(--border-soft);
align-items: center;
}
.audit-row:last-child { border-bottom: none; }
.audit-row:hover { background: var(--bg); }
.audit-date {
color: var(--text-dim);
font-family: 'JetBrains Mono', ui-monospace, monospace;
white-space: nowrap;
}
.audit-action {
color: var(--text);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audit-ip {
color: var(--text-faint);
font-family: 'JetBrains Mono', ui-monospace, monospace;
text-align: right;
}
/* ---- Filters dropdown + chips ------------------------ */
.filters-wrap { position: relative; }
.filters-count {
position: absolute;
top: -2px; right: -4px;
background: var(--accent);
color: white;
font-size: 9px;
font-weight: 700;
padding: 1px 5px;
border-radius: 8px;
line-height: 1.3;
pointer-events: none;
}
.filters-menu {
position: absolute;
top: calc(100% + 4px); right: 0;
background: var(--bg-elev);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
box-shadow: var(--shadow-lg);
z-index: 60;
min-width: 240px;
padding: 6px;
}
.filters-menu-title {
padding: 4px 8px 6px;
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--text-faint);
}
.filters-menu-row {
display: flex; align-items: center; gap: 8px;
padding: 6px 8px;
cursor: pointer;
border-radius: 4px;
font-size: 13px;
color: var(--text);
}
.filters-menu-row:hover { background: var(--accent-soft); }
.filters-menu-row svg { width: 14px; height: 14px; color: var(--text-dim); }
.filters-menu-cb {
margin: 0;
accent-color: var(--accent);
cursor: pointer;
}
.filters-menu-clear {
width: 100%;
margin-top: 6px;
padding: 6px 8px;
background: none;
border: 1px solid var(--border);
border-radius: 4px;
color: var(--text-dim);
font-size: 12px;
cursor: pointer;
}
.filters-menu-clear:hover {
color: var(--text);
border-color: var(--accent);
}
.filter-chips {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
padding: 8px 0;
margin-bottom: 4px;
}
.filter-chip {
display: inline-flex; align-items: center; gap: 6px;
background: var(--accent-soft);
color: var(--accent);
border: 1px solid var(--accent);
border-radius: 14px;
padding: 3px 4px 3px 10px;
font-size: 11px;
font-weight: 600;
}
.filter-chip svg { width: 12px; height: 12px; }
.filter-chip-x {
display: inline-flex; align-items: center; justify-content: center;
width: 16px; height: 16px;
background: none;
border: none;
cursor: pointer;
color: var(--accent);
border-radius: 50%;
padding: 0;
}
.filter-chip-x:hover { background: var(--accent); color: white; }
.filter-chip-x svg { width: 10px; height: 10px; }
.filter-chips-clear {
background: none;
border: none;
color: var(--text-faint);
font-size: 11px;
cursor: pointer;
padding: 3px 8px;
text-decoration: underline;
}
.filter-chips-clear:hover { color: var(--text-dim); }
/* ---- Note cards (kind=note) -------------------------- */
.entry-note-row {
display: flex; align-items: center;
@@ -2168,6 +2357,140 @@ input[type="password"]::-ms-clear {
}
.nav-item:hover .nav-count { display: none; }
/* Folder edit (pencil) button — same hover-reveal as the delete X. */
.nav-item .folder-edit {
width: 20px; height: 20px;
padding: 0;
line-height: 0;
display: inline-flex; align-items: center; justify-content: center;
background: transparent; border: none;
color: var(--text-faint);
border-radius: 4px;
opacity: 0;
transition: opacity var(--t-fast), color var(--t-fast), background var(--t-fast);
cursor: pointer;
}
.nav-item .folder-edit svg { width: 13px; height: 13px; display: block; }
.nav-item:hover .folder-edit { opacity: 0.7; }
.nav-item .folder-edit:hover {
opacity: 1;
color: var(--accent);
background: var(--accent-soft);
}
/* When folder-edit is rendered before folder-delete in the DOM, push delete
to the far right so the layout stays {icon} {label} … {edit} {delete}. */
.nav-item .folder-edit + .folder-delete { margin-left: 2px; }
/* ============================================================
FOLDER CUSTOMIZATION MODAL
============================================================ */
#folderModal .form-field { margin-bottom: 14px; }
#folderModal .form-field label {
display: block;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--text-faint);
margin-bottom: 4px;
}
#folderModal .so-input { width: 100%; }
/* ============================================================
ATTACHMENTS list inside the slideover
============================================================ */
.so-attach-list {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 6px;
}
.so-attach-empty {
font-size: 12px;
color: var(--text-faint);
padding: 6px 2px;
font-style: italic;
}
.so-attach-row {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 6px;
}
.so-attach-info {
flex: 1;
min-width: 0;
}
.so-attach-name {
font-size: 13px;
color: var(--text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.so-attach-meta {
font-size: 11px;
color: var(--text-faint);
margin-top: 1px;
}
.so-attach-row .icon-btn { flex-shrink: 0; }
.folder-swatch-row,
.folder-icon-row {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-top: 6px;
}
.folder-swatch {
width: 26px; height: 26px;
border-radius: 50%;
border: 2px solid transparent;
background: var(--bg-elev);
cursor: pointer;
padding: 0;
transition: transform var(--t-fast), border-color var(--t-fast);
}
.folder-swatch:hover { transform: scale(1.1); }
.folder-swatch.is-active {
border-color: var(--text);
box-shadow: 0 0 0 2px var(--bg);
}
.folder-swatch.is-default {
background:
linear-gradient(135deg, transparent 47%, var(--danger) 47% 53%, transparent 53%),
var(--bg-elev);
}
.folder-icon-btn {
width: 36px; height: 36px;
display: inline-flex; align-items: center; justify-content: center;
border: 1px solid var(--border);
background: var(--bg-elev);
border-radius: 6px;
cursor: pointer;
color: var(--text-dim);
transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.folder-icon-btn svg { width: 18px; height: 18px; }
.folder-icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }
.folder-icon-btn.is-active {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-soft);
}
.folder-preview {
display: flex; align-items: center; gap: 10px;
margin: 16px 0 4px;
padding: 12px 14px;
background: var(--bg-elev);
border-radius: 6px;
color: var(--text);
font-weight: 500;
}
.folder-preview svg { width: 18px; height: 18px; }
/* Remember username checkbox row on auth screen. */
.remember-row {
display: flex; align-items: center; gap: 8px;
@@ -2241,3 +2564,53 @@ input[type="password"]::-ms-clear {
font-size: 12px;
cursor: pointer;
}
/* ============================================================
PRINTABLE RECOVERY CODE — only renders on the printed page
============================================================ */
#printRecoveryArea { display: none; }
@media print {
/* Hide the running app entirely; show only the printable sheet. */
body > *:not(#printRecoveryArea) { display: none !important; }
#printRecoveryArea {
display: block !important;
position: static;
background: #fff !important;
color: #000 !important;
}
.prc-sheet {
font-family: Georgia, 'Times New Roman', serif;
padding: 40px;
max-width: 700px;
margin: 0 auto;
}
.prc-sheet h1 {
font-size: 22px;
margin: 0 0 18px;
border-bottom: 2px solid #000;
padding-bottom: 8px;
}
.prc-meta {
display: flex;
justify-content: space-between;
font-size: 12px;
margin-bottom: 28px;
}
.prc-code {
font-family: 'Courier New', monospace;
font-size: 32px;
letter-spacing: 6px;
text-align: center;
padding: 24px;
border: 2px dashed #000;
margin: 28px 0;
font-weight: bold;
}
.prc-instructions {
font-size: 13px;
line-height: 1.6;
}
.prc-instructions ol { padding-left: 22px; }
@page { margin: 1.5cm; }
}