Skip to content

Commit 5de7507

Browse files
committed
Skip injection on browser URLS
1 parent 6bd3af0 commit 5de7507

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Public/popup.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { urlMatchesPattern } from "./utils/urlMatchPattern.js";
2-
2+
/* global chrome */
33
document.addEventListener("DOMContentLoaded", async () => {
44
// Apply theme first
55
await applyThemeFromSettings();
@@ -214,6 +214,13 @@ document.addEventListener("DOMContentLoaded", async () => {
214214
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
215215
if (!tab?.id) return;
216216

217+
//skip exacution on browser pages
218+
const restrictedPatterns = /^(chrome|edge|about):\/\//i;
219+
if (restrictedPatterns.test(tab.url || "")) {
220+
menuSection.style.display = "none";
221+
return;
222+
}
223+
217224
const [{ result: commands = [] }] = await chrome.scripting.executeScript({
218225
target: { tabId: tab.id },
219226
world: "MAIN",
@@ -225,7 +232,6 @@ document.addEventListener("DOMContentLoaded", async () => {
225232
return;
226233
}
227234

228-
// Deduplicate commands with same caption from same scriptId
229235
const unique = [];
230236
const seen = new Set();
231237
commands.forEach((c) => {

0 commit comments

Comments
 (0)