Skip to content

Commit

Permalink
Update warning-page.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kenhendricks00 authored Nov 10, 2024
1 parent b3e30db commit 30259fb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pub/warning-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@ document.addEventListener("DOMContentLoaded", () => {
`Sending approveSite message for tab ${currentTab.id} and URL ${unsafeUrl}`
);

// Send approval message to the background script
await browserAPI.runtime.sendMessage({
// Approve the site and wait for confirmation from the background script
const response = await browserAPI.runtime.sendMessage({
action: "approveSite",
tabId: currentTab.id,
url: unsafeUrl,
});

console.log("Approval stored, navigating to the unsafe URL...");
// Redirect to the approved unsafe URL
await browserAPI.tabs.update(currentTab.id, { url: unsafeUrl });
if (response && response.status === "approved") {
console.log("Approval confirmed, navigating to the unsafe URL...");

// Redirect to the approved unsafe URL
await browserAPI.tabs.update(currentTab.id, { url: unsafeUrl });
} else {
console.error("Approval failed or no response from background.");
}
}
}
});
Expand Down

0 comments on commit 30259fb

Please sign in to comment.