From 1c92b3d62ed027d4123b0bc0e278ef35501f475a Mon Sep 17 00:00:00 2001 From: Kenneth Hendricks <50819541+kenhendricks00@users.noreply.github.com> Date: Sat, 2 Nov 2024 21:30:19 -0400 Subject: [PATCH] Add files via upload --- platform/firefox/pub/warning-page.html | 211 +++++++++++++++++++++++++ platform/firefox/pub/warning-page.js | 30 ++++ 2 files changed, 241 insertions(+) create mode 100644 platform/firefox/pub/warning-page.html create mode 100644 platform/firefox/pub/warning-page.js diff --git a/platform/firefox/pub/warning-page.html b/platform/firefox/pub/warning-page.html new file mode 100644 index 0000000..dc8590e --- /dev/null +++ b/platform/firefox/pub/warning-page.html @@ -0,0 +1,211 @@ + + + + + + FMHY SafeGuard - Warning + + + + + + + +
+

FMHY SafeGuard

+
+ Warning +

+

+ This site has been flagged as unsafe.
+ Be cautious when interacting with this site. +

+
+ + +
+
+ +
+ + diff --git a/platform/firefox/pub/warning-page.js b/platform/firefox/pub/warning-page.js new file mode 100644 index 0000000..b88c83d --- /dev/null +++ b/platform/firefox/pub/warning-page.js @@ -0,0 +1,30 @@ +document.addEventListener("DOMContentLoaded", () => { + const urlParams = new URLSearchParams(window.location.search); + const unsafeUrl = urlParams.get("url") || "unknown site"; + document.getElementById("unsafeUrl").textContent = unsafeUrl; + console.log(`Warning page loaded for URL: ${unsafeUrl}`); + + document.getElementById("goBack").addEventListener("click", () => { + console.log("User clicked Go Back."); + // Go back twice to skip over the warning page + window.history.go(-2); + }); + + document.getElementById("proceed").addEventListener("click", async () => { + if (confirm("Are you sure you want to proceed? This site may be unsafe.")) { + const [tab] = await browser.tabs.query({ + active: true, + currentWindow: true, + }); + + console.log(`Sending proceedAnyway message for tab ${tab.id}`); + await browser.runtime.sendMessage({ + action: "proceedAnyway", + tabId: tab.id, + }); + + console.log("Proceed flag set, navigating to unsafe URL..."); + await browser.tabs.update(tab.id, { url: unsafeUrl }); + } + }); +});