Merge pull request #57 from outis1one/claude/read-repo-YMu21
fix: config race condition — use persistent JSON element, bump 0.9.20
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Silent Send",
|
"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.",
|
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Silent Send",
|
"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.",
|
"description": "Intercepts personal info and substitutes it with user-defined replacements before sending to AI services.",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "silent-send",
|
"name": "silent-send",
|
||||||
"version": "0.9.19",
|
"version": "0.9.20",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Browser extension that substitutes personal data before sending to AI services",
|
"description": "Browser extension that substitutes personal data before sending to AI services",
|
||||||
|
|||||||
@@ -26,12 +26,13 @@
|
|||||||
let settings = { enabled: true, revealMode: false, showHighlights: false };
|
let settings = { enabled: true, revealMode: false, showHighlights: false };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const configEl = document.querySelector('script[data-ss-config]');
|
const configEl = document.getElementById('ss-config-data');
|
||||||
if (configEl) {
|
if (configEl) {
|
||||||
const config = JSON.parse(configEl.getAttribute('data-ss-config'));
|
const config = JSON.parse(configEl.textContent);
|
||||||
mappings = config.mappings || [];
|
mappings = config.mappings || [];
|
||||||
identity = config.identity || {};
|
identity = config.identity || {};
|
||||||
settings = { ...settings, ...(config.settings || {}) };
|
settings = { ...settings, ...(config.settings || {}) };
|
||||||
|
configEl.remove(); // clean up
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Silent Send] Failed to parse initial config:', e);
|
console.warn('[Silent Send] Failed to parse initial config:', e);
|
||||||
|
|||||||
@@ -97,9 +97,17 @@
|
|||||||
identity = mergeProfiles(identity);
|
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
|
// Inject the main interception script into the page's world
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.setAttribute('data-ss-config', JSON.stringify({ mappings, identity, settings }));
|
|
||||||
script.src = api.runtime.getURL('src/content/content.js');
|
script.src = api.runtime.getURL('src/content/content.js');
|
||||||
(document.head || document.documentElement).appendChild(script);
|
(document.head || document.documentElement).appendChild(script);
|
||||||
script.onload = () => script.remove();
|
script.onload = () => script.remove();
|
||||||
|
|||||||
@@ -631,7 +631,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>Silent Send v0.9.19</p>
|
<p>Silent Send v0.9.20</p>
|
||||||
<p style="font-size:11px;color:#9ca3af;margin-top:6px;max-width:600px">
|
<p style="font-size:11px;color:#9ca3af;margin-top:6px;max-width:600px">
|
||||||
Silent Send is a convenience tool, not a security guarantee. Third-party sites may change how they send data at any time, which can cause missed substitutions without warning. You are responsible for verifying your data before sending. See the <a href="https://github.com/outis1one/silent-send/blob/main/LICENSE" target="_blank" style="color:#6b7280">LICENSE</a> for full terms.
|
Silent Send is a convenience tool, not a security guarantee. Third-party sites may change how they send data at any time, which can cause missed substitutions without warning. You are responsible for verifying your data before sending. See the <a href="https://github.com/outis1one/silent-send/blob/main/LICENSE" target="_blank" style="color:#6b7280">LICENSE</a> for full terms.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user