From a7179e047fd2158b18608d2e2dc7272bc5c8e077 Mon Sep 17 00:00:00 2001 From: Sreecharan <65058816+sr2echa@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:37:04 +0530 Subject: [PATCH] Fix injection in chrome:// & others --- background.js | 10 +++++++++- manifest.json | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 18833c0..6025102 100644 --- a/background.js +++ b/background.js @@ -1,5 +1,13 @@ let extensionStatus = 'on'; +chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { + if (tab.url.startsWith("chrome://")) { + // Set extension status to 'off' or prevent script injection + extensionStatus = 'off'; + chrome.action.setIcon({ path: "icons/off.png", tabId: tabId }); + } +}); + // Create context menus on installation chrome.runtime.onInstalled.addListener(() => { chrome.contextMenus.create({ @@ -350,7 +358,7 @@ function showHelpToast() { const overlay = document.createElement('div'); overlay.id = overlayId; - overlay.innerHTML = ``; + overlay.innerHTML = ``; overlay.style.cssText = 'position: fixed; bottom: 20px; right: 20px; z-index: 9999;'; document.body.appendChild(overlay); diff --git a/manifest.json b/manifest.json index 0c5bfca..7d52321 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ "content_scripts": [ { "matches": [""], - "js": ["data/inject/rightclickmenu.js","data/inject/isolated.js", "data/inject/content.js", "data/inject/main.js"] + "exclude_matches": ["*://*.discord.com/*", "*://*.figma.com/*"], + "js": ["data/inject/rightclickmenu.js", "data/inject/isolated.js", "data/inject/content.js", "data/inject/main.js"] } ], "commands": {