Add site connection permissions, approval flow, and active address
Some checks failed
check / check (push) Has been cancelled
Some checks failed
check / check (push) Has been cancelled
- Add activeAddress, allowedSites, deniedSites, rememberSiteChoice to persisted state - Replace auto-connect with permission checks: allowed sites connect automatically, denied sites are rejected, unknown sites trigger an approval popup - Add approval popup UI with hostname display, active address preview, remember checkbox, and allow/deny buttons - Add ACTIVE/[select] indicator on address rows in the main view to set the active web3 address - Add allowed/denied site list management in settings with delete buttons - Broadcast accountsChanged to connected dapps when active address changes - Handle approval window close as implicit denial
This commit is contained in:
@@ -63,9 +63,29 @@ async function init() {
|
||||
|
||||
await loadState();
|
||||
|
||||
// Auto-default active address
|
||||
if (
|
||||
state.activeAddress === null &&
|
||||
state.wallets.length > 0 &&
|
||||
state.wallets[0].addresses.length > 0
|
||||
) {
|
||||
state.activeAddress = state.wallets[0].addresses[0].address;
|
||||
await saveState();
|
||||
}
|
||||
|
||||
// Check for approval mode
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const approvalId = params.get("approval");
|
||||
if (approvalId) {
|
||||
approval.show(parseInt(approvalId, 10));
|
||||
showView("approve");
|
||||
return;
|
||||
}
|
||||
|
||||
$("btn-settings").addEventListener("click", () => {
|
||||
$("settings-rpc").value = state.rpcUrl;
|
||||
$("settings-blockscout").value = state.blockscoutUrl;
|
||||
settings.renderSiteLists();
|
||||
showView("settings");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user