diff --git a/extensions/dist/gnexus-creds-extension-chrome-0.2.0.zip b/extensions/dist/gnexus-creds-extension-chrome-0.2.0.zip deleted file mode 100644 index 6ab913a..0000000 --- a/extensions/dist/gnexus-creds-extension-chrome-0.2.0.zip +++ /dev/null Binary files differ diff --git a/extensions/dist/gnexus-creds-extension-chrome-0.2.1.zip b/extensions/dist/gnexus-creds-extension-chrome-0.2.1.zip new file mode 100644 index 0000000..5977341 --- /dev/null +++ b/extensions/dist/gnexus-creds-extension-chrome-0.2.1.zip Binary files differ diff --git a/extensions/dist/gnexus-creds-extension-firefox-0.2.0.zip b/extensions/dist/gnexus-creds-extension-firefox-0.2.0.zip deleted file mode 100644 index f26c317..0000000 --- a/extensions/dist/gnexus-creds-extension-firefox-0.2.0.zip +++ /dev/null Binary files differ diff --git a/extensions/dist/gnexus-creds-extension-firefox-0.2.1.zip b/extensions/dist/gnexus-creds-extension-firefox-0.2.1.zip new file mode 100644 index 0000000..014e607 --- /dev/null +++ b/extensions/dist/gnexus-creds-extension-firefox-0.2.1.zip Binary files differ diff --git a/extensions/extension/Makefile b/extensions/extension/Makefile index 9defc32..1494343 100644 --- a/extensions/extension/Makefile +++ b/extensions/extension/Makefile @@ -1,5 +1,5 @@ NAME := gnexus-creds-extension -VERSION := 0.2.0 +VERSION := 0.2.1 # Per-file prerequisites: a directory prerequisite (plain "src") never goes # stale when only a file inside it is edited. SRC := manifest.json $(shell find src icons lib -type f) diff --git a/extensions/extension/manifest.json b/extensions/extension/manifest.json index c2271a5..cac27a8 100644 --- a/extensions/extension/manifest.json +++ b/extensions/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "gnexus-creds", - "version": "0.2.0", + "version": "0.2.1", "description": "Browser extension for gnexus-creds secret manager.", "permissions": ["storage", "activeTab", "alarms"], "host_permissions": ["https://*/*", "http://*/*"], diff --git a/extensions/extension/src/content.js b/extensions/extension/src/content.js index 84a1361..757c5ef 100644 --- a/extensions/extension/src/content.js +++ b/extensions/extension/src/content.js @@ -273,9 +273,18 @@ return secretsForDomain.some((s) => (s.source || "").includes(domain) || (s.title || "").includes(domain)); } +let lastNotified = { at: 0, signature: "" }; + function notifyPendingSave(username, password) { const domain = location.hostname; if (isAlreadySaved(domain, username)) return; + // The same login can be caught by both the submit event and the button-click + // fallback below (or an inline submit() that bypasses the event) — send a + // duplicate only if the credentials changed + const signature = `${username}\u0000${password}`; + const now = Date.now(); + if (lastNotified.signature === signature && now - lastNotified.at < 1500) return; + lastNotified = { at: now, signature }; const title = `${domain} — ${username || "account"}`; chrome.runtime.sendMessage( { @@ -305,13 +314,26 @@ // --- Intercept form submit --- function attachSubmitInterceptor(form, usernameInput, passwordInput) { + // Capture credentials the same way regardless of what triggered the login + function captureFromTrigger() { + const username = usernameInput?.value?.trim() || ""; + const password = passwordInput?.value?.trim() || ""; + if (!password) return; + notifyPendingSave(username, password); + } + if (form) { - form.addEventListener("submit", () => { - const username = usernameInput?.value?.trim() || ""; - const password = passwordInput?.value?.trim() || ""; - if (!password) return; - notifyPendingSave(username, password); - }, true); + form.addEventListener("submit", captureFromTrigger, true); + // Some sites (DLE's `