fix: reveal mode broken + missing await + select rendering — v2.0.10

Bug 1 - Reveal mode not working (all browsers):
sessionSubstitutions stored "ademo demo" (full name) as key, but
buildRevealPairs looked up "ademo" and "demo" individually. No match,
no reveal pairs, reveal did nothing. Fixed by also storing individual
words from multi-word replacements so both "ademo demo" AND "ademo"
AND "demo" are in the map.

Bug 2 - Missing await on _handleDecryptedMeta (sync.js):
Two call sites returned the Promise instead of the resolved value.
Downstream code checking decResult.data got undefined. Added await.

Bug 3 - Profile selector broken by safeHTML (popup.js):
DOMParser.parseFromString wraps content in <html><body> which
mangles <option> elements when moved to a <select>. Replaced with
new Option() DOM API which creates proper option elements.

https://claude.ai/code/session_01SWSwDfMVij53bCTNSCLMwn
This commit is contained in:
Claude
2026-03-27 12:41:47 +00:00
parent 97e37e65ac
commit 85fbc6c4d0
7 changed files with 33 additions and 13 deletions
+16 -2
View File
@@ -784,11 +784,25 @@
// Record what was actually substituted so reveal knows
for (const r of replacements) {
if (r.replaced && r.original) {
// Store with lowercase key for lookup, but preserve original case
// Store full replacement with lowercase key for lookup
sessionSubstitutions.set(r.replaced.toLowerCase(), {
original: r.original,
replaced: r.replaced, // preserve original case
replaced: r.replaced,
});
// Also store individual words so reveal pairs match identity entries
// e.g. "Ademo Demo" → store "ademo" and "demo" separately
const replacedWords = r.replaced.split(/\s+/);
const originalWords = r.original.split(/\s+/);
if (replacedWords.length > 1) {
for (let i = 0; i < replacedWords.length; i++) {
if (replacedWords[i] && originalWords[i]) {
sessionSubstitutions.set(replacedWords[i].toLowerCase(), {
original: originalWords[i],
replaced: replacedWords[i],
});
}
}
}
}
}