fix: duplicate optAutoRedact ID + hardcoded log limit + add test suite
Bug 1: popup.html had duplicate id="optAutoRedact" on both the Auto Redact toggle and Auto-redact Detected PII toggle. The second overwrote the first, making the Auto Redact setting uncontrollable. Fixed by giving the second toggle id="optAutoRedactDetected". Bug 2: injector.js hardcoded activity log trim to 100, ignoring the user's maxLogEntries setting. Now reads the setting from storage. Added test-suite.html with 35+ tests covering storage, encryption, sync (encryption-mandatory flows), auto-redact (built-in + custom patterns), substitution engine, smart patterns, and auto-detect. https://claude.ai/code/session_01KF4i7Ra7zCEDskxDBaNtcT
This commit is contained in:
@@ -91,6 +91,8 @@
|
||||
// Also log directly from the injector (content script world)
|
||||
// in case the background worker is asleep
|
||||
const replacements = event.data.replacements || [];
|
||||
const settingsResult = await api.storage.local.get('ss_settings');
|
||||
const maxLog = settingsResult.ss_settings?.maxLogEntries || 100;
|
||||
for (const r of replacements) {
|
||||
const log = (await api.storage.local.get('ss_activity_log')).ss_activity_log || [];
|
||||
log.unshift({
|
||||
@@ -104,8 +106,8 @@
|
||||
pattern: r.pattern || '',
|
||||
url: location.href,
|
||||
});
|
||||
// Trim
|
||||
if (log.length > 100) log.length = 100;
|
||||
// Trim to user-configured max
|
||||
if (log.length > maxLog) log.length = maxLog;
|
||||
await api.storage.local.set({ ss_activity_log: log });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
<strong>Auto-redact detected PII</strong>
|
||||
<span class="setting-desc">Replace detected PII with placeholders on send</span>
|
||||
</div>
|
||||
<label class="toggle"><input type="checkbox" id="optAutoRedact" checked><span class="toggle-slider"></span></label>
|
||||
<label class="toggle"><input type="checkbox" id="optAutoRedactDetected" checked><span class="toggle-slider"></span></label>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
|
||||
+2
-2
@@ -222,7 +222,7 @@ async function initUnlockedUI() {
|
||||
// Load options tab settings
|
||||
$('#optAutoRedact').checked = settings.autoRedact !== false;
|
||||
$('#optAutoDetect').checked = settings.autoDetect !== false;
|
||||
$('#optAutoRedact').checked = settings.autoRedactDetected !== false;
|
||||
$('#optAutoRedactDetected').checked = settings.autoRedactDetected !== false;
|
||||
$('#optHighlights').checked = settings.showHighlights || false;
|
||||
$('#optDocPreview').checked = settings.docScanPreview !== false;
|
||||
|
||||
@@ -230,7 +230,7 @@ async function initUnlockedUI() {
|
||||
const optHandlers = [
|
||||
['optAutoRedact', 'autoRedact'],
|
||||
['optAutoDetect', 'autoDetect'],
|
||||
['optAutoRedact', 'autoRedactDetected'],
|
||||
['optAutoRedactDetected', 'autoRedactDetected'],
|
||||
['optHighlights', 'showHighlights'],
|
||||
['optDocPreview', 'docScanPreview'],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user