diff --git a/manifest.firefox.json b/manifest.firefox.json index e01cb92..76ac735 100644 --- a/manifest.firefox.json +++ b/manifest.firefox.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Silent Send", - "version": "0.9.19", + "version": "0.9.20", "description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.", "browser_specific_settings": { "gecko": { diff --git a/manifest.json b/manifest.json index 22cf700..1e43db5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Silent Send", - "version": "0.9.19", + "version": "0.9.20", "description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.", "permissions": [ "storage", diff --git a/package.json b/package.json index 2c8ed42..c3aebd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "silent-send", - "version": "0.9.19", + "version": "0.9.20", "private": true, "license": "MIT", "description": "Browser extension that substitutes personal data before sending to AI services", diff --git a/src/content/content.js b/src/content/content.js index 3f9db50..af8b13d 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -26,12 +26,13 @@ let settings = { enabled: true, revealMode: false, showHighlights: false }; try { - const configEl = document.querySelector('script[data-ss-config]'); + const configEl = document.getElementById('ss-config-data'); if (configEl) { - const config = JSON.parse(configEl.getAttribute('data-ss-config')); + const config = JSON.parse(configEl.textContent); mappings = config.mappings || []; identity = config.identity || {}; settings = { ...settings, ...(config.settings || {}) }; + configEl.remove(); // clean up } } catch (e) { console.warn('[Silent Send] Failed to parse initial config:', e); diff --git a/src/content/injector.js b/src/content/injector.js index 4c3d5a2..9574bdc 100644 --- a/src/content/injector.js +++ b/src/content/injector.js @@ -97,9 +97,17 @@ 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); + // 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(); diff --git a/src/options/options.html b/src/options/options.html index 3e52028..3db2c07 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -629,7 +629,7 @@