feat: Add Enterprise App Protection extension with settings and popup UI

- Implement manifest.json for Chrome extension with necessary permissions and background scripts.
- Create options.html for user settings including Google Safe Browsing API key, domains database URL, update interval, and warning message template.
- Develop options.js to handle loading and saving settings using Chrome storage.
- Design popup.html to display suspicious links and provide options to update the database and manage domains.
- Implement popup.js to manage interactions in the popup, including updating the database and resetting the suspicious links counter.
- Add testsite.html for dynamic testing of the extension with both official and fake links.
This commit is contained in:
becarta
2025-05-10 03:25:49 +02:00
commit ba83c95914
21 changed files with 1485 additions and 0 deletions

39
domains_management.js Normal file
View File

@@ -0,0 +1,39 @@
document.addEventListener("DOMContentLoaded", function () {
const saveButton = document.getElementById("save");
const trustedInput = document.getElementById("trusted");
const blockedInput = document.getElementById("blocked");
// Load saved domains
chrome.storage.local.get(["trustedDomains", "blockedDomains"], function (data) {
if (data.trustedDomains) trustedInput.value = data.trustedDomains.join("\n");
if (data.blockedDomains) blockedInput.value = data.blockedDomains.join("\n");
});
// Save button event
saveButton.addEventListener("click", function () {
// Retrieve domains from input fields
const trustedDomains = trustedInput.value.split("\n").map(d => d.trim()).filter(d => d);
const blockedDomains = blockedInput.value.split("\n").map(d => d.trim()).filter(d => d);
// Save to Chrome storage
chrome.storage.local.set({ trustedDomains, blockedDomains }, function () {
showPopup("✅ Changes saved successfully!");
});
});
// Function to show styled popup message
function showPopup(message) {
const popup = document.getElementById("popupMessage");
const popupText = document.getElementById("popupText");
const popupClose = document.getElementById("popupClose");
popupText.innerText = message;
popup.classList.remove("hidden");
popup.classList.add("visible");
popupClose.addEventListener("click", function () {
popup.classList.remove("visible");
popup.classList.add("hidden");
});
}
});