revert: restore entire src/ from pre-doc-scanner commit (e4b44a7)

Going back to a known-good baseline. This version had:
- Working reveal mode with CSS Highlight API
- Working substitution (fetch + XHR hooks)
- Smart patterns (names, emails, phones, usernames)
- Encryption/sync (password, TOTP, WebAuthn)
- Multiple identity profiles
- Activity log
- Secret scanner
- Auto-detect PII warnings
- Pre-send PII detection

Kept current manifests (UUID, data_collection_permissions, version).
No renames applied — uses original naming (secretScanning, PPI, etc).
Will re-apply renames and new features from this working base.

https://claude.ai/code/session_01KF4i7Ra7zCEDskxDBaNtcT
This commit is contained in:
Claude
2026-03-29 18:45:10 +00:00
parent 73bc08dad2
commit 2719e1be44
17 changed files with 302 additions and 1902 deletions
+2 -127
View File
@@ -35,7 +35,7 @@
border-radius: 2px;
}
/* Auto-detect PII warning banner */
/* Auto-detect PPI warning banner */
.ss-autodetect-warning {
position: fixed;
top: 16px;
@@ -136,7 +136,7 @@
font-style: italic;
}
/* Pre-send PII warning (spellcheck-style, appears while typing) */
/* Pre-send PPI warning (spellcheck-style, appears while typing) */
.ss-presend-warning {
position: fixed;
top: 16px;
@@ -220,21 +220,6 @@
.ss-ps-add:hover { background: rgba(74, 222, 128, 0.15); }
.ss-ps-add:disabled { border-color: #333; cursor: default; }
.ss-ps-ignore {
background: #4b5563;
border: none;
color: #d1d5db;
font-size: 9px;
cursor: pointer;
flex-shrink: 0;
padding: 3px 6px;
border-radius: 3px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.ss-ps-ignore:hover { color: #e5e7eb; text-decoration: underline; }
/* Floating reveal mode indicator */
.ss-reveal-badge {
position: fixed;
@@ -259,113 +244,3 @@
opacity: 1;
transform: translateY(0);
}
/* Document scan preview overlay */
.ss-doc-preview {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.95);
max-width: 480px;
width: 90vw;
background: #1a1a1a;
color: #e5e7eb;
border: 1px solid #f59e0b;
border-radius: 12px;
padding: 16px 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 12px;
z-index: 9999999;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
opacity: 0;
pointer-events: none;
transition: opacity 0.2s, transform 0.2s;
max-height: 70vh;
overflow-y: auto;
}
.ss-doc-preview.visible {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
pointer-events: auto;
}
.ss-dp-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.ss-dp-count {
font-size: 11px;
color: #f59e0b;
font-weight: 600;
}
.ss-dp-note {
font-size: 11px;
color: #9ca3af;
margin-bottom: 10px;
font-style: italic;
}
.ss-dp-items {
max-height: 200px;
overflow-y: auto;
margin-bottom: 12px;
}
.ss-dp-item {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 0;
border-bottom: 1px solid #333;
font-size: 11px;
}
.ss-dp-item:last-child { border-bottom: none; }
.ss-dp-orig {
color: #f87171;
background: #1f1f1f;
padding: 2px 5px;
border-radius: 3px;
}
.ss-dp-repl {
color: #4ade80;
background: #1f1f1f;
padding: 2px 5px;
border-radius: 3px;
}
.ss-dp-actions {
display: flex;
gap: 8px;
}
.ss-dp-btn {
flex: 1;
padding: 8px 12px;
border: none;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
}
.ss-dp-confirm {
background: #10b981;
color: #fff;
}
.ss-dp-confirm:hover { background: #059669; }
.ss-dp-cancel {
background: #374151;
color: #e5e7eb;
}
.ss-dp-cancel:hover { background: #4b5563; }
+125 -787
View File
File diff suppressed because it is too large Load Diff
+10 -45
View File
@@ -57,57 +57,22 @@
// Load mappings and settings, then inject into page
async function init() {
let mappings, identity, settings;
const result = await api.storage.local.get(['ss_mappings', 'ss_identity', 'ss_settings']);
const isEncrypted = result.ss_mappings?._ssLocalEncrypted ||
result.ss_identity?._ssLocalEncrypted;
const settings = result.ss_settings || { enabled: true };
if (isEncrypted) {
// Data is encrypted — ask the background script for decrypted config.
// The background has access to the Storage module which can decrypt.
try {
const response = await api.runtime.sendMessage({ type: 'get:decrypted-config' });
if (response?.mappings) {
mappings = response.mappings;
identity = response.identity || {};
settings = response.settings || { enabled: true };
} else {
// Background couldn't decrypt (locked) — inject with empty config
// and wait for vault:unlocked message later
mappings = [];
identity = {};
settings = result.ss_settings || { enabled: true };
}
} catch {
mappings = [];
identity = {};
settings = result.ss_settings || { enabled: true };
}
} else {
// Data is plaintext — read directly
mappings = result.ss_mappings || [];
const identityData = result.ss_identity || {};
identity = mergeProfiles(identityData);
settings = result.ss_settings || { enabled: true };
}
// Check if data is encrypted (locked) — pass empty config
// The background will send decrypted data via vault:unlocked when ready
const isLocked = result.ss_mappings?._ssLocalEncrypted ||
result.ss_identity?._ssLocalEncrypted;
const mappings = isLocked ? [] : (result.ss_mappings || []);
const identityData = isLocked ? {} : (result.ss_identity || {});
// Ensure identity is merged if it came from background
if (identity.profiles) {
identity = mergeProfiles(identity);
}
// Inject config as a global variable before loading content.js
// Using a separate inline-data element ensures content.js can read it
// even if there's a race condition with script.onload removal
const configEl = document.createElement('script');
configEl.type = 'application/json';
configEl.id = 'ss-config-data';
configEl.textContent = JSON.stringify({ mappings, identity, settings });
(document.head || document.documentElement).appendChild(configEl);
// Merge active profiles into a flat identity object for the content script
const identity = mergeProfiles(identityData);
// Inject the main interception script into the page's world
const script = document.createElement('script');
script.setAttribute('data-ss-config', JSON.stringify({ mappings, identity, settings }));
script.src = api.runtime.getURL('src/content/content.js');
(document.head || document.documentElement).appendChild(script);
script.onload = () => script.remove();