merge: integrate claude/read-repo-YMu21 branch
Merged changes from the other session: - Ko-fi support link in options footer - PPI → PII renaming across codebase - Legal/licensing updates (stronger disclaimer, non-commercial only) - Custom secret/auto-redact patterns - Internal refactoring of secret scanner to auto-redact naming - Custom domains in popup Options tab - Additional AI services (Perplexity, DeepSeek, HuggingChat, Poe) - Developer sites (GitHub, GitLab, Reddit, StackOverflow, Pastebin) - Dynamic content script registration for custom domains Resolved conflicts in options.html and popup.html (kept newer "Auto Redact" naming with custom patterns description). https://claude.ai/code/session_01SWSwDfMVij53bCTNSCLMwn
This commit is contained in:
+22
-22
@@ -1,6 +1,6 @@
|
||||
import SubstitutionEngine from '../lib/substitution-engine.js';
|
||||
import SmartPatterns from '../lib/smart-patterns.js';
|
||||
import SecretScanner from '../lib/secret-scanner.js';
|
||||
import AutoRedact from '../lib/auto-redact.js';
|
||||
import AutoDetect from '../lib/auto-detect.js';
|
||||
import Storage from '../lib/storage.js';
|
||||
import SilentSendSync from '../lib/sync.js';
|
||||
@@ -214,7 +214,7 @@ async function initUnlockedUI() {
|
||||
});
|
||||
|
||||
// Load options tab settings
|
||||
$('#optSecretScanning').checked = settings.secretScanning !== false;
|
||||
$('#optAutoRedact').checked = settings.autoRedact !== false;
|
||||
$('#optAutoDetect').checked = settings.autoDetect !== false;
|
||||
$('#optAutoRedact').checked = settings.autoRedactDetected !== false;
|
||||
$('#optHighlights').checked = settings.showHighlights || false;
|
||||
@@ -223,7 +223,7 @@ async function initUnlockedUI() {
|
||||
|
||||
// Options tab change handlers
|
||||
const optHandlers = [
|
||||
['optSecretScanning', 'secretScanning'],
|
||||
['optAutoRedact', 'autoRedact'],
|
||||
['optAutoDetect', 'autoDetect'],
|
||||
['optAutoRedact', 'autoRedactDetected'],
|
||||
['optHighlights', 'showHighlights'],
|
||||
@@ -715,16 +715,16 @@ function renderTestDiff() {
|
||||
|
||||
const smartResult = SmartPatterns.substitute(input, identity);
|
||||
const explicitResult = SubstitutionEngine.substitute(smartResult.text, mappings);
|
||||
const secretResult = SecretScanner.redact(explicitResult.text);
|
||||
const redactResult = AutoRedact.redact(explicitResult.text, settings.customRedactPatterns);
|
||||
|
||||
const allReplacements = [
|
||||
...smartResult.replacements,
|
||||
...explicitResult.replacements,
|
||||
...secretResult.redactions,
|
||||
...redactResult.redactions,
|
||||
];
|
||||
const finalText = secretResult.text;
|
||||
const finalText = redactResult.text;
|
||||
|
||||
if (finalText === input && secretResult.warnings.length === 0) {
|
||||
if (finalText === input && redactResult.warnings.length === 0) {
|
||||
output.textContent = input;
|
||||
stats.textContent = 'No substitutions detected';
|
||||
return;
|
||||
@@ -740,8 +740,8 @@ function renderTestDiff() {
|
||||
`<span class="sub-highlight" title="Was: ${escapeHtml(r.original)} [${r.pattern || r.category}]">${escapedReplaced}</span>`
|
||||
);
|
||||
}
|
||||
// Highlight secret redactions in red
|
||||
for (const r of secretResult.redactions) {
|
||||
// Highlight auto-redactions in red
|
||||
for (const r of redactResult.redactions) {
|
||||
const escapedReplaced = escapeHtml(r.replaced);
|
||||
html = html.replace(
|
||||
escapedReplaced,
|
||||
@@ -752,28 +752,28 @@ function renderTestDiff() {
|
||||
|
||||
const smartCount = smartResult.replacements.length;
|
||||
const explicitCount = explicitResult.replacements.length;
|
||||
const secretCount = secretResult.redactions.length;
|
||||
const warnCount = secretResult.warnings.length;
|
||||
const redactCount = redactResult.redactions.length;
|
||||
const warnCount = redactResult.warnings.length;
|
||||
const parts = [];
|
||||
if (smartCount > 0) parts.push(`${smartCount} smart`);
|
||||
if (explicitCount > 0) parts.push(`${explicitCount} explicit`);
|
||||
if (secretCount > 0) parts.push(`${secretCount} secrets redacted`);
|
||||
if (redactCount > 0) parts.push(`${redactCount} auto-redacted`);
|
||||
if (warnCount > 0) parts.push(`${warnCount} warnings`);
|
||||
|
||||
// Auto-detect unconfigured PPI in the final text
|
||||
const ppiWarnings = AutoDetect.scan(finalText, identity);
|
||||
if (ppiWarnings.length > 0) parts.push(`${ppiWarnings.length} PPI detected`);
|
||||
// Auto-detect unconfigured PII in the final text
|
||||
const piiWarnings = AutoDetect.scan(finalText, identity);
|
||||
if (piiWarnings.length > 0) parts.push(`${piiWarnings.length} PII detected`);
|
||||
|
||||
stats.textContent = `${allReplacements.length} substitution${allReplacements.length !== 1 ? 's' : ''} (${parts.join(', ')})`;
|
||||
|
||||
// Show PPI warnings below stats
|
||||
if (ppiWarnings.length > 0) {
|
||||
const ppiDiv = document.createElement('div');
|
||||
safeHTML(ppiDiv, `<div style="margin-top:6px;padding:6px 8px;background:#fef3c7;border-radius:4px;color:#92400e;font-size:11px">
|
||||
<strong>Unconfigured PPI detected:</strong>
|
||||
${ppiWarnings.map(w => `<div style="margin-top:3px"><code style="background:#fff;padding:1px 4px;border-radius:2px;color:#b45309">${escapeHtml(w.value)}</code> — ${w.hint}</div>`).join('')}
|
||||
// Show PII warnings below stats
|
||||
if (piiWarnings.length > 0) {
|
||||
const piiDiv = document.createElement('div');
|
||||
safeHTML(piiDiv, `<div style="margin-top:6px;padding:6px 8px;background:#fef3c7;border-radius:4px;color:#92400e;font-size:11px">
|
||||
<strong>Unconfigured PII detected:</strong>
|
||||
${piiWarnings.map(w => `<div style="margin-top:3px"><code style="background:#fff;padding:1px 4px;border-radius:2px;color:#b45309">${escapeHtml(w.value)}</code> — ${w.hint}</div>`).join('')}
|
||||
</div>`);
|
||||
stats.appendChild(ppiDiv);
|
||||
stats.appendChild(piiDiv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user