From 10839577cd9cdaaaa12c6a30f7c6991f2b326f25 Mon Sep 17 00:00:00 2001 From: hensm Date: Sun, 28 Jun 2020 06:16:09 +0100 Subject: [PATCH] Prevent duplicate whitelist entries with menu UI --- ext/src/background/background.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/src/background/background.ts b/ext/src/background/background.ts index 02a0550..dc607b3 100755 --- a/ext/src/background/background.ts +++ b/ext/src/background/background.ts @@ -139,10 +139,11 @@ async function initMenus () { } const whitelist = await options.get("userAgentWhitelist"); - - // Add to whitelist and update options - whitelist.push(pattern); - await options.set("userAgentWhitelist", whitelist); + if (!whitelist.includes(pattern)) { + // Add to whitelist and update options + whitelist.push(pattern); + await options.set("userAgentWhitelist", whitelist); + } return; }