diff --git a/platform/firefox/pub/index.html b/platform/firefox/pub/index.html
deleted file mode 100644
index d6dd24b..0000000
--- a/platform/firefox/pub/index.html
+++ /dev/null
@@ -1,215 +0,0 @@
-
-
-
-
-
- FMHY SafeGuard
-
-
-
-
-
-

-
Checking site status...
-
-
-
-
-
-
-
-
diff --git a/platform/firefox/pub/index.js b/platform/firefox/pub/index.js
deleted file mode 100644
index 57fa05c..0000000
--- a/platform/firefox/pub/index.js
+++ /dev/null
@@ -1,179 +0,0 @@
-document.addEventListener("DOMContentLoaded", async () => {
- console.log("Popup loaded, preparing to check site status...");
-
- const statusIcon = document.getElementById("status-icon");
- const statusMessage = document.getElementById("status-message");
- const errorMessage = document.getElementById("error-message");
-
- // Helper function to normalize URLs (removes trailing slashes, query parameters, and fragments)
- const normalizeUrl = (url) => {
- const urlObj = new URL(url);
- urlObj.search = ""; // Remove query parameters
- urlObj.hash = ""; // Remove fragments
- return urlObj.href.replace(/\/+$/, ""); // Remove trailing slash only
- };
-
- // Helper function to extract the root domain from a URL
- function extractRootDomain(url) {
- let urlObj = new URL(url);
- return `${urlObj.protocol}//${urlObj.hostname}`;
- }
-
- // Function to apply theme based on settings
- async function applyTheme() {
- try {
- const { theme } = await browser.storage.sync.get("theme");
-
- if (theme === "dark") {
- document.body.setAttribute("data-theme", "dark");
- } else if (theme === "light") {
- document.body.setAttribute("data-theme", "light");
- } else {
- const prefersDark = window.matchMedia(
- "(prefers-color-scheme: dark)"
- ).matches;
- document.body.setAttribute(
- "data-theme",
- prefersDark ? "dark" : "light"
- );
- }
- } catch (error) {
- console.error("Error applying theme:", error);
- }
- }
-
- // Apply theme on load
- await applyTheme();
-
- try {
- // Get the active tab's URL
- const [activeTab] = await browser.tabs.query({
- active: true,
- currentWindow: true,
- });
-
- if (!activeTab || !activeTab.url) {
- throw new Error("No active tab found or URL is unavailable.");
- }
-
- const currentUrl = normalizeUrl(activeTab.url);
- const rootDomain = extractRootDomain(currentUrl);
- console.log(`Active tab URL: ${currentUrl}, Root domain: ${rootDomain}`);
-
- // Send a message to the background script to check the site's status
- const response = await browser.runtime.sendMessage({
- action: "checkSiteStatus",
- url: currentUrl,
- });
-
- if (!response || !response.status) {
- throw new Error(
- "Failed to retrieve site status from the background script."
- );
- }
-
- // Determine if the root domain or the full URL is marked as safe/starred
- const isRootDomainMarked = await browser.runtime.sendMessage({
- action: "checkSiteStatus",
- url: rootDomain,
- });
-
- // Handle different site statuses and update the UI accordingly
- if (
- isRootDomainMarked.status === response.status &&
- response.status !== "no_data"
- ) {
- // If both the root domain and the current URL share the same status, show the root domain in the message
- handleStatusUpdate(response.status, rootDomain);
- } else {
- // Otherwise, show the current URL in the message
- handleStatusUpdate(response.status, currentUrl);
- }
- } catch (error) {
- console.error("Error while checking site status:", error);
- errorMessage.textContent = `Error: ${error.message}`;
- updateUI("error", "An error occurred while retrieving the site status.");
- }
-
- /**
- * Updates the UI based on the site status
- * @param {string} status - The status of the site (e.g., "safe", "unsafe")
- * @param {string} displayUrl - The URL or root domain to display in the message
- */
- function handleStatusUpdate(status, displayUrl) {
- switch (status) {
- case "unsafe":
- updateUI(
- "unsafe",
- `${displayUrl} is flagged as unsafe. Be cautious when interacting with this site.`
- );
- break;
- case "potentially_unsafe":
- updateUI(
- "potentially_unsafe",
- `${displayUrl} is potentially unsafe. Proceed with caution.`
- );
- break;
- case "fmhy":
- updateUI(
- "fmhy",
- `${displayUrl} is an FMHY related site. Proceed confidently.`
- );
- break;
- case "safe":
- updateUI("safe", `${displayUrl} is safe to browse.`);
- break;
- case "starred":
- updateUI(
- "starred",
- `${displayUrl} is a starred site.`
- );
- break;
- case "no_data":
- updateUI(
- "no_data",
- `No data available for ${displayUrl}.`
- );
- break;
- default:
- updateUI(
- "unknown",
- `An unknown status was received for ${displayUrl}.`
- );
- }
- }
-
- /**
- * Updates the UI with the appropriate icon, message, and effects.
- * @param {string} status - The status of the site (e.g., "safe", "unsafe").
- * @param {string} message - The message to display to the user.
- */
- function updateUI(status, message) {
- const icons = {
- unsafe: "../res/icons/unsafe.png",
- potentially_unsafe: "../res/icons/potentially_unsafe.png",
- fmhy: "../res/icons/fmhy.png",
- safe: "../res/icons/safe.png",
- starred: "../res/icons/starred.png",
- no_data: "../res/ext_icon_144.png",
- error: "../res/icons/error.png",
- unknown: "../res/ext_icon_144.png",
- };
-
- // Update the icon and message
- statusIcon.src = icons[status] || icons["unknown"];
- statusMessage.innerHTML = message || "An unknown error occurred.";
-
- // Add a small animation when the status changes
- statusIcon.classList.add("active");
- setTimeout(() => statusIcon.classList.remove("active"), 300);
-
- console.log(`UI updated: ${message}`);
- }
-
- // Add settings button functionality
- document.getElementById("settingsButton").addEventListener("click", () => {
- // Open the settings page in a new tab
- browser.runtime.openOptionsPage();
- });
-});
diff --git a/platform/firefox/pub/settings-page.html b/platform/firefox/pub/settings-page.html
deleted file mode 100644
index 3d8faec..0000000
--- a/platform/firefox/pub/settings-page.html
+++ /dev/null
@@ -1,605 +0,0 @@
-
-
-
-
-
- FMHY SafeGuard - Settings
-
-
-
-
-
-
FMHY SafeGuard Settings
-
-
-
-
-
-
-
-
-
-
Potentially Unsafe Sites
-
46
-
-
-
-
-
- Next update scheduled for: Checking...
-
-
-
-
-
-
-
-
Theme
-
- Choose your preferred appearance mode
-
-
-
-
-
-
-
-
-
-
-
-
-
Warning Page
-
- Show warning page for unsafe sites
-
-
-
-
-
-
-
-
-
-
-
Auto-Update Filterlist
-
- Automatically update security filters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Settings saved successfully!
-
-
-
-
-
diff --git a/platform/firefox/pub/settings-page.js b/platform/firefox/pub/settings-page.js
deleted file mode 100644
index afbc718..0000000
--- a/platform/firefox/pub/settings-page.js
+++ /dev/null
@@ -1,272 +0,0 @@
-document.addEventListener("DOMContentLoaded", () => {
- // Get all DOM elements
- const themeSelect = document.getElementById("themeSelect");
- const warningToggle = document.getElementById("warningToggle");
- const updateFrequency = document.getElementById("updateFrequency");
- const saveButton = document.getElementById("saveSettings");
- const notification = document.getElementById("notification");
- const lastUpdated = document.getElementById("lastUpdated");
- const updateStatus = document.getElementById("updateStatus");
-
- // Theme application function
- function applyTheme(theme) {
- if (theme === "system") {
- const prefersDark = window.matchMedia(
- "(prefers-color-scheme: dark)"
- ).matches;
- document.body.setAttribute("data-theme", prefersDark ? "dark" : "light");
- } else {
- document.body.setAttribute("data-theme", theme);
- }
- }
-
- // Format date function
- function formatDate(date) {
- if (!date) return "Never";
- const d = new Date(date);
- const now = new Date();
- const diffTime = Math.abs(now - d);
- const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
-
- if (diffDays === 0) {
- return (
- "Today at " +
- d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
- );
- } else if (diffDays === 1) {
- return (
- "Yesterday at " +
- d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
- );
- } else {
- return (
- d.toLocaleDateString() +
- " " +
- d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
- );
- }
- }
-
- // Calculate next update time
- function calculateNextUpdate(lastUpdate, frequency) {
- if (!lastUpdate) return "Not scheduled";
- const lastUpdateDate = new Date(lastUpdate);
- let nextUpdate = new Date(lastUpdateDate);
-
- switch (frequency) {
- case "daily":
- nextUpdate.setDate(nextUpdate.getDate() + 1);
- nextUpdate.setHours(0, 0, 0, 0);
- break;
- case "weekly":
- nextUpdate.setDate(nextUpdate.getDate() + 7);
- nextUpdate.setHours(0, 0, 0, 0);
- break;
- case "monthly":
- nextUpdate.setMonth(nextUpdate.getMonth() + 1);
- nextUpdate.setHours(0, 0, 0, 0);
- break;
- default:
- return "Not scheduled";
- }
-
- const now = new Date();
- if (nextUpdate < now) {
- return "Update pending...";
- }
-
- // Format the next update time
- const timeUntil = nextUpdate - now;
- const hoursUntil = Math.floor(timeUntil / (1000 * 60 * 60));
- const minutesUntil = Math.floor(
- (timeUntil % (1000 * 60 * 60)) / (1000 * 60)
- );
-
- if (hoursUntil < 24) {
- if (hoursUntil === 0) {
- return `in ${minutesUntil} minutes`;
- } else {
- return `in ${hoursUntil}h ${minutesUntil}m`;
- }
- } else {
- const days = Math.floor(hoursUntil / 24);
- if (days === 1) {
- return "tomorrow";
- } else {
- return `in ${days} days`;
- }
- }
- }
-
- // Update the UI with next update time
- async function updateNextUpdateStatus() {
- try {
- const stats = await browser.storage.local.get({
- lastUpdated: null,
- });
- const settings = await browser.storage.sync.get({
- updateFrequency: "daily",
- });
-
- const nextUpdateText = calculateNextUpdate(
- stats.lastUpdated,
- settings.updateFrequency
- );
-
- if (updateStatus) {
- updateStatus.innerHTML = `
-
- Next update ${nextUpdateText}
- `;
- }
- } catch (error) {
- console.error("Error updating next update status:", error);
- if (updateStatus) {
- updateStatus.textContent = "Unable to check next update time";
- }
- }
- }
-
- // Load filterlist stats
- async function loadFilterlistStats() {
- try {
- const stats = await browser.storage.local.get({
- unsafeFilterCount: 0,
- potentiallyUnsafeFilterCount: 0,
- safeSiteCount: 0,
- lastUpdated: null,
- });
-
- console.log("Fetched stats:", stats);
-
- document.getElementById("unsafeFilterCount").textContent =
- stats.unsafeFilterCount;
- document.getElementById("potentiallyUnsafeFilterCount").textContent =
- stats.potentiallyUnsafeFilterCount;
- document.getElementById("safeSiteCount").textContent =
- stats.safeSiteCount;
- document.getElementById("lastUpdated").textContent = formatDate(
- stats.lastUpdated
- );
-
- // Update the next update status
- await updateNextUpdateStatus();
- } catch (error) {
- console.error("Error loading filterlist stats:", error);
- document.getElementById("unsafeFilterCount").textContent = "Error";
- document.getElementById("potentiallyUnsafeFilterCount").textContent =
- "Error";
- document.getElementById("safeSiteCount").textContent = "Error";
- document.getElementById("lastUpdated").textContent = "Error";
- }
- }
-
- // Load settings function
- async function loadSettings() {
- try {
- const savedSettings = await browser.storage.sync.get({
- theme: "system",
- warningPage: true,
- updateFrequency: "daily",
- });
-
- if (themeSelect) themeSelect.value = savedSettings.theme;
- if (warningToggle) warningToggle.checked = savedSettings.warningPage;
- if (updateFrequency)
- updateFrequency.value = savedSettings.updateFrequency;
-
- // Apply theme
- applyTheme(savedSettings.theme);
-
- // Load filterlist stats after settings are loaded
- await loadFilterlistStats();
- } catch (error) {
- console.error("Error loading settings:", error);
- showNotification("Error loading settings", true);
- }
- }
-
- // Show notification function
- function showNotification(message, isError = false) {
- if (notification) {
- notification.textContent = message;
- if (isError) {
- notification.style.background =
- "linear-gradient(120deg, #ff6b6b, #ff8787)";
- } else {
- notification.style.background =
- "linear-gradient(120deg, var(--accent-purple), var(--accent-blue))";
- }
- notification.classList.add("show");
- setTimeout(() => {
- notification.classList.remove("show");
- }, 3000);
- }
- }
-
- // Save settings function
- async function saveSettings() {
- try {
- const settings = {
- theme: themeSelect.value,
- warningPage: warningToggle.checked,
- updateFrequency: updateFrequency.value,
- };
-
- await browser.storage.sync.set(settings);
-
- // Show success notification
- showNotification("Settings saved successfully!");
-
- // Apply theme immediately
- applyTheme(settings.theme);
-
- // Update next update status
- await updateNextUpdateStatus();
-
- // Notify background script about settings change
- await browser.runtime.sendMessage({
- type: "settingsUpdated",
- settings: settings,
- });
- } catch (error) {
- console.error("Error saving settings:", error);
- showNotification("Error saving settings", true);
- }
- }
-
- // Event Listeners
- if (saveButton) {
- saveButton.addEventListener("click", saveSettings);
- }
-
- if (themeSelect) {
- themeSelect.addEventListener("change", (e) => {
- applyTheme(e.target.value);
- });
- }
-
- // System theme change listener
- window
- .matchMedia("(prefers-color-scheme: dark)")
- .addEventListener("change", (e) => {
- if (themeSelect && themeSelect.value === "system") {
- applyTheme("system");
- }
- });
-
- // Listen for filterlist updates from background script
- browser.runtime.onMessage.addListener((message) => {
- if (message.type === "filterlistUpdated") {
- loadFilterlistStats();
- }
- });
-
- // Update the status every minute
- setInterval(updateNextUpdateStatus, 60000);
-
- // Load settings when page loads
- loadSettings();
-});
diff --git a/platform/firefox/pub/warning-page.html b/platform/firefox/pub/warning-page.html
deleted file mode 100644
index 5cf1733..0000000
--- a/platform/firefox/pub/warning-page.html
+++ /dev/null
@@ -1,212 +0,0 @@
-
-
-
-
-
- FMHY SafeGuard - Warning
-
-
-
-
-
-
-
FMHY SafeGuard
-
-

-
-
- 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
deleted file mode 100644
index b88c83d..0000000
--- a/platform/firefox/pub/warning-page.js
+++ /dev/null
@@ -1,30 +0,0 @@
-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 });
- }
- });
-});