04/19 Update extension: persistent session, duplication check - again

This commit is contained in:
2026-04-19 17:25:35 -04:00
parent e3d007b654
commit 66e0129994
5 changed files with 111 additions and 14 deletions
+2 -2
View File
@@ -243,10 +243,10 @@ body {
flex: 1;
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 3px;
padding: 8px 6px;
padding: 8px 4px;
background: none; border: none; cursor: pointer;
color: #9ca3af;
font-size: 10px; font-weight: 500;
font-size: 9px; font-weight: 500;
transition: color 0.15s;
}
.nav-btn:hover { color: #374151; }
+18 -2
View File
@@ -126,12 +126,28 @@
</svg>
<span>Vault</span>
</button>
<button class="nav-btn" id="nav-account" title="Sign out">
<button class="nav-btn" id="nav-generator" title="Password Generator">
<svg viewBox="0 0 24 24" fill="none" width="20" height="20">
<path d="M12 2a5 5 0 015 5v1h1a2 2 0 012 2v9a2 2 0 01-2 2H6a2 2 0 01-2-2v-9a2 2 0 012-2h1V7a5 5 0 015-5z" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round"/>
<circle cx="12" cy="14" r="1.8" fill="currentColor"/>
<path d="M12 14v2.5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>
</svg>
<span>Generator</span>
</button>
<button class="nav-btn" id="nav-alerts" title="Security Alerts">
<svg viewBox="0 0 24 24" fill="none" width="20" height="20">
<path d="M12 3l8.5 15H3.5L12 3z" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round"/>
<path d="M12 10v4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>
<circle cx="12" cy="17" r="0.8" fill="currentColor"/>
</svg>
<span>Alerts</span>
</button>
<button class="nav-btn" id="nav-account" title="Account">
<svg viewBox="0 0 24 24" fill="none" width="20" height="20">
<circle cx="12" cy="8" r="4" stroke="currentColor" stroke-width="1.7"/>
<path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>
</svg>
<span>Sign out</span>
<span>Account</span>
</button>
</nav>
+12 -1
View File
@@ -11,8 +11,10 @@
* we refresh the access_token and show the unlock-only view (master password only).
*/
const API_BASE = 'https://pwkeeper.ngodanguyen.tech';
const API_BASE = 'https://pwkeeper.ngodanguyen.tech';
const VAULT_URL = 'https://pwkeeper.ngodanguyen.tech/vault';
const GEN_URL = 'https://pwkeeper.ngodanguyen.tech/vault#generator';
const ALERTS_URL = 'https://pwkeeper.ngodanguyen.tech/vault#security';
// ── State ─────────────────────────────────────────────────────────────────────
@@ -531,6 +533,15 @@ async function init() {
// Vault actions
$('btn-add-item').addEventListener('click', () => { chrome.tabs.create({ url: VAULT_URL }); });
$('nav-account').addEventListener('click', signOut);
$('nav-generator').addEventListener('click', () => { chrome.tabs.create({ url: GEN_URL }); });
$('nav-alerts').addEventListener('click', () => { chrome.tabs.create({ url: ALERTS_URL }); });
// Keep the service worker alive so chrome.storage.session survives while the
// browser is open. We ping it every 20 s; the ping itself is a no-op but
// prevents the SW from being killed between popup openings.
const _keepalive = setInterval(() => {
chrome.runtime.sendMessage({ type: 'KEEPALIVE' }).catch(() => {});
}, 20_000);
// Search
$('vault-search').addEventListener('input', () => renderList());