diff --git a/public/warning.html b/public/warning.html
new file mode 100644
index 0000000..48e1f39
--- /dev/null
+++ b/public/warning.html
@@ -0,0 +1,41 @@
+
+
+
+
+ Blocked Website
+
+
+
+
+ Warning: Blocked Website
+ You are attempting to visit a website that is on the DefiLlama blacklist.
+ To proceed at your own risk, turn off 'Block blacklisted websites' in the DefiLlama extension.
+
+
+
\ No newline at end of file
diff --git a/src/manifest.ts b/src/manifest.ts
index 8ca709f..e79eb91 100755
--- a/src/manifest.ts
+++ b/src/manifest.ts
@@ -27,6 +27,7 @@ const manifest: ManifestType = {
web_accessible_resources: [
{
resources: [
+ "warning.html",
"src/pages/content/index.js",
"assets/js/*.js",
"assets/css/*.css",
diff --git a/src/pages/background/index.ts b/src/pages/background/index.ts
index a93890d..78b33fa 100644
--- a/src/pages/background/index.ts
+++ b/src/pages/background/index.ts
@@ -28,6 +28,7 @@ async function getCurrentTab() {
async function handlePhishingCheck() {
const phishingDetector = await getStorage("local", "settings:phishingDetector", true);
+ const blockBlacklisted = await getStorage("local", "settings:blockBlacklisted", true);
if (!phishingDetector) {
Browser.action.setIcon({ path: cute });
return;
@@ -35,6 +36,7 @@ async function handlePhishingCheck() {
let isPhishing = false;
let isTrusted = false;
+ let isBlacklisted = false;
let reason = "Unknown website";
const tab = await getCurrentTab();
try {
@@ -68,6 +70,10 @@ async function handlePhishingCheck() {
reason = "Unknown website";
}
}
+
+ if (blockBlacklisted && res.type === "blocked") {
+ isBlacklisted = true;
+ }
}
} catch (error) {
console.log("handlePhishingCheck error", error);
@@ -76,6 +82,11 @@ async function handlePhishingCheck() {
reason = "Invalid URL";
}
+ if (isBlacklisted) {
+ Browser.tabs.update(tab.id, { url: Browser.runtime.getURL('warning.html?url=' + encodeURIComponent(tab.url)) });
+ return;
+ }
+
if (isTrusted) {
Browser.action.setIcon({ path: upOnly });
Browser.action.setTitle({ title: reason });
diff --git a/src/pages/popup/Popup.tsx b/src/pages/popup/Popup.tsx
index e0ac9d6..ee9b3ed 100644
--- a/src/pages/popup/Popup.tsx
+++ b/src/pages/popup/Popup.tsx
@@ -10,6 +10,7 @@ const Popup = () => {
const [priceInjector, setPriceInjector] = useBrowserStorage("local", "settings:priceInjector", true);
const [tagsInjector, setTagsInjector] = useBrowserStorage("local", "settings:tagsInjector", true);
const [phishingDetector, setPhishingDetector] = useBrowserStorage("local", "settings:phishingDetector", true);
+ const [blockBlacklisted, setBlockBlacklisted] = useBrowserStorage("local", "settings:blockBlacklisted", true);
const [phishingHandleDetector, setPhishingHandleDetector] = useBrowserStorage(
"local",
"settings:phishingHandleDetector",
@@ -42,13 +43,25 @@ const Popup = () => {
}
}}
/>
+
+
+ Block blacklisted websites
+ {
+ setBlockBlacklisted(e.target.checked);
+ if (!e.target.checked) {
+ Browser.action.setIcon({ path: cuteStatic });
+ }
+ }}
+ />
Twitter
-
Mitigate phishing scams