feat: disable until configured + auto permission request for custom domains
Interception is now completely inactive until the user configures at least one identity field or explicit mapping. Before that: - Icon shows gray (unconfigured) - No fetch/XHR hooks fire - First-run banner tells user to set up Custom domains: clicking "Add Domain" in Options now triggers the browser's native permission prompt via permissions.request(). No more manual chrome://extensions site access step. Icon states are now: - Gray = unconfigured (nothing will happen) - Black = active and protecting - Blue = reveal mode on - Red = manually disabled https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
<button class="btn btn-primary" id="btnAddDomain">Add Domain</button>
|
||||
</div>
|
||||
<p class="section-desc" style="margin-top:8px;margin-bottom:0">
|
||||
After adding a domain in Chrome, you also need to grant permission: <code>chrome://extensions/</code> → Silent Send → Details → Site access → add the domain.
|
||||
When you click "Add Domain", your browser will ask you to confirm access. No extra steps needed.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Storage from '../lib/storage.js';
|
||||
import api from '../lib/browser-polyfill.js';
|
||||
|
||||
let mappings = [];
|
||||
let settings = {};
|
||||
@@ -206,6 +207,20 @@ async function addDomain() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Request browser permission for this domain
|
||||
try {
|
||||
const granted = await api.permissions.request({
|
||||
origins: [domain + '/*'],
|
||||
});
|
||||
if (!granted) {
|
||||
alert('Permission denied. The extension needs access to this domain to work.');
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
// Firefox or older Chrome may not support optional permissions this way
|
||||
console.warn('[Silent Send] Could not request permission:', e);
|
||||
}
|
||||
|
||||
domains.push(domain);
|
||||
settings.customDomains = domains;
|
||||
await Storage.saveSettings({ customDomains: domains });
|
||||
|
||||
Reference in New Issue
Block a user