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
+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());