04/26 Enhanced functionalities
This commit is contained in:
@@ -182,6 +182,18 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||
// Store in local storage so the prompt survives service worker restarts
|
||||
// and is guaranteed to be present when the user next opens the popup.
|
||||
chrome.storage.local.set({ pending_save: msg.data });
|
||||
// Show a global "!" badge on the toolbar icon so the user knows to open
|
||||
// the popup even if they never do so otherwise.
|
||||
chrome.action.setBadgeText({ text: "!" });
|
||||
chrome.action.setBadgeBackgroundColor({ color: "#c0392b" });
|
||||
console.log("[PassKeeper] pending_save badge set for", msg.data?.siteName);
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the pending-save badge once the popup signals it has handled the prompt.
|
||||
if (msg.type === "CLEAR_SAVE_BADGE") {
|
||||
chrome.action.setBadgeText({ text: "" });
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,5 +50,14 @@
|
||||
"16": "icons/icon16.png",
|
||||
"48": "icons/icon48.png",
|
||||
"128": "icons/icon128.png"
|
||||
},
|
||||
"commands": {
|
||||
"_execute_action": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+L",
|
||||
"mac": "Command+Shift+L"
|
||||
},
|
||||
"description": "Open PassKeeper"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -714,16 +714,21 @@ async function checkPendingSave() {
|
||||
$('save-name').focus();
|
||||
|
||||
// Wire buttons — use onclick so re-running checkPendingSave never double-binds.
|
||||
$('btn-save-yes').onclick = async () => {
|
||||
// Helper to dismiss the overlay, clear storage, and remove the toolbar badge.
|
||||
function _clearPendingSave() {
|
||||
$('save-prompt-overlay').classList.add('hidden');
|
||||
chrome.storage.local.remove('pending_save');
|
||||
chrome.runtime.sendMessage({ type: 'CLEAR_SAVE_BADGE' }).catch(() => {});
|
||||
}
|
||||
|
||||
$('btn-save-yes').onclick = async () => {
|
||||
console.log('[PassKeeper] User saved credential for', pending_save.siteName);
|
||||
await saveCredential(pending_save);
|
||||
await chrome.storage.local.remove('pending_save');
|
||||
_clearPendingSave();
|
||||
};
|
||||
$('btn-save-no').onclick = async () => {
|
||||
$('save-prompt-overlay').classList.add('hidden');
|
||||
$('btn-save-no').onclick = () => {
|
||||
console.log('[PassKeeper] User dismissed save prompt for', pending_save.siteName);
|
||||
await chrome.storage.local.remove('pending_save');
|
||||
_clearPendingSave();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user