18958b371f86

identity autocomplete on username/email fields in inline popup edit mode (v2.38.14)

time
2026-05-12 16:47 UTC · 5 months ago
machine
koh2
parent
262ece8cc27d
3 files manifest.firefox.json+1 −1manifest.json+1 −1src/content/inject.ts+22 −15
manifest.firefox.json+1 −1
@@ -1,7 +1,7 @@11 {22   "manifest_version": 3,33   "name": "Peach",4-  "version": "2.38.13",4+  "version": "2.38.14",55   "description": "Zero-knowledge password manager",66   "browser_specific_settings": {77     "gecko": {

view file

manifest.json+1 −1
@@ -1,7 +1,7 @@11 {22   "manifest_version": 3,33   "name": "Peach",4-  "version": "2.38.13",4+  "version": "2.38.14",55   "description": "Zero-knowledge password manager",66   "action": {77     "default_popup": "src/popup/index.html",

view file

src/content/inject.ts+22 −15
@@ -2136,18 +2136,23 @@21362136     wrap.appendChild(body);21372137     container.appendChild(wrap);21382138 2139-    const res = (await chrome.runtime.sendMessage({2140-      type: "GET_ENTRY_FOR_FILL",2141-      payload: { id: summary.id },2142-    }).catch(() => null)) as { ok: boolean; data?: { title?: string; username?: string; email?: string; password?: string; url?: string; totp?: string; notes?: string } } | null;2139+    const [res, idRes] = await Promise.all([2140+      chrome.runtime.sendMessage({2141+        type: "GET_ENTRY_FOR_FILL",2142+        payload: { id: summary.id },2143+      }).catch(() => null),2144+      chrome.runtime.sendMessage({ type: "GET_IDENTITIES" }).catch(() => null),2145+    ]);2146+    const entryRes = res as { ok: boolean; data?: { title?: string; username?: string; email?: string; password?: string; url?: string; totp?: string; notes?: string } } | null;2147+    const editIdentities: SavedIdentity[] = (idRes as { ok?: boolean; data?: SavedIdentity[] } | null)?.data ?? [];21432148 2144-    if (!res || !res.ok || !res.data) {2149+    if (!entryRes || !entryRes.ok || !entryRes.data) {21452150       loading.textContent = "couldn't load this entry. try again from the popup.";21462151       return;21472152     }21482153     body.innerHTML = "";21492154 2150-    function field(label: string, value: string, type: "text" | "password" = "text"): HTMLInputElement {2155+    function field(label: string, value: string, type: "text" | "password" = "text"): { g: HTMLDivElement; inp: HTMLInputElement } {21512156       const group = document.createElement("div");21522157       group.className = "f-group";21532158       const lbl = document.createElement("div");@@ -2160,15 +2165,17 @@21602165       input.autocomplete = "off";21612166       group.append(lbl, input);21622167       body.appendChild(group);2163-      return input;2168+      return { g: group, inp: input };21642169     }21652170 2166-    const titleInput = field("title", res.data.title ?? "");2167-    const urlInput = field("url", res.data.url ?? "");2171+    const titleInput = field("title", entryRes.data.title ?? "").inp;2172+    const urlInput = field("url", entryRes.data.url ?? "").inp;21682173     urlInput.classList.add("url-f");2169-    const usernameLabel = (res.data.username ?? "").includes("@") ? "email" : "username";2170-    const usernameInput = field(usernameLabel, res.data.username ?? "");2171-    const emailInput = field("email", res.data.email ?? "");2174+    const usernameLabel = (entryRes.data.username ?? "").includes("@") ? "email" : "username";2175+    const { g: usernameGroup, inp: usernameInput } = field(usernameLabel, entryRes.data.username ?? "");2176+    if (editIdentities.length) attachIdentitySuggestions(usernameGroup, usernameInput, editIdentities);2177+    const { g: emailGroup, inp: emailInput } = field("email", entryRes.data.email ?? "");2178+    if (editIdentities.length) attachIdentitySuggestions(emailGroup, emailInput, editIdentities);21722179 21732180     // Password row with reveal toggle21742181     const pwGroup = document.createElement("div");@@ -2181,7 +2188,7 @@21812188     const pwInput = document.createElement("input");21822189     pwInput.className = "f-input";21832190     pwInput.type = "password";2184-    pwInput.value = res.data.password ?? "";2191+    pwInput.value = entryRes.data.password ?? "";21852192     pwInput.autocomplete = "new-password";21862193     const revealBtn = document.createElement("button");21872194     revealBtn.className = "gen-btn";@@ -2196,7 +2203,7 @@21962203     pwGroup.append(pwLbl, pwRow);21972204     body.appendChild(pwGroup);21982205 2199-    const totpInput = field("2fa secret", res.data.totp ?? "");2206+    const totpInput = field("2fa secret", entryRes.data.totp ?? "").inp;22002207 22012208     // Notes22022209     const notesGroup = document.createElement("div");@@ -2207,7 +2214,7 @@22072214     const notesInput = document.createElement("textarea");22082215     notesInput.className = "f-input";22092216     notesInput.rows = 3;2210-    notesInput.value = res.data.notes ?? "";2217+    notesInput.value = entryRes.data.notes ?? "";22112218     notesInput.style.fontFamily = "Inter, sans-serif";22122219     notesInput.style.resize = "vertical";22132220     notesGroup.append(notesLbl, notesInput);

view file