fix(clipboard): copy toasts reflect the configured clear delay

The "clears in 30s" suffix was hardcoded in ~14 toasts. Single helper
clipClearSuffix() reads clipboardClearSeconds (''=Never); prefixes concatenated
to it. Cheatsheet text made generic "(auto-clears)".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-12 19:42:26 +01:00
parent 8cfa1b0d6a
commit 2c7f6188e3
3 changed files with 21 additions and 14 deletions
+3 -3
View File
@@ -152,7 +152,7 @@ async function quickSearchPickEntry(entry, mode) {
if (!u) { toast('No username on this entry', 'warning'); return; }
if (Bridge.active) Bridge.copySecure(u, 30000);
else { try { await navigator.clipboard.writeText(u); } catch (_) {} }
toast('Username copied · clears in 30s');
toast('Username copied' + clipClearSuffix());
} else {
const pwd = await decryptPwd(entry.encrypted_password, entry.iv);
if (pwd === '[ERROR]') { toast('Decryption error', 'error'); return; }
@@ -202,7 +202,7 @@ const CHEATSHEET_GROUPS = [
title: 'On each card',
items: [
{ keys: [{ icon: 'i-globe' }], desc: 'Open the site in your default browser' },
{ keys: [{ icon: 'i-copy' }], desc: 'Copy password to the secure clipboard (auto-clears in 30s)' },
{ keys: [{ icon: 'i-copy' }], desc: 'Copy password to the secure clipboard (auto-clears)' },
{ keys: ['Click card'], desc: 'Open the entry details / edit panel' },
],
},
@@ -306,7 +306,7 @@ async function openHistoryModal(entryId) {
copy.addEventListener('click', () => {
if (Bridge.active) Bridge.copySecure(plain, 30000);
else { try { navigator.clipboard.writeText(plain); } catch (_) {} }
toast('Copied · clears in 30s');
toast('Copied' + clipClearSuffix());
});
preview.appendChild(copy);