From 950ab269aaaf8db4d8b45a14980f40072e14f456 Mon Sep 17 00:00:00 2001 From: Kevin Payravi Date: Tue, 27 Jun 2023 03:12:42 -0500 Subject: [PATCH] Updating BreezeWiki hosts + fixing dupe counts --- background.js | 25 +++++++++++++++++-------- content.js | 2 +- manifest2.json | 10 +++++++--- manifest3.json | 14 ++++++++++---- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/background.js b/background.js index e766dce..1bd0c04 100644 --- a/background.js +++ b/background.js @@ -44,10 +44,13 @@ if (chrome.declarativeNetRequest) { '*://antifandom.com/*', '*://bw.projectsegfau.lt/*', '*://breeze.hostux.net/*', - '*://breeze.777.tf/*', '*://breezewiki.pussthecat.org/*', '*://bw.vern.cc/*', - '*://breezewiki.esmailelbob.xyz/*' + '*://breezewiki.esmailelbob.xyz/*', + '*://bw.artemislena.eu/*', + '*://bw.hamstro.dev/*', + '*://nerd.whatever.social/*', + '*://breeze.nohost.network/*' ], types: [ 'main_frame' @@ -94,12 +97,10 @@ function updateDeclarativeRule() { chrome.storage.local.get(function (localStorage) { chrome.storage.sync.get(function (syncStorage) { const storage = { ...syncStorage, ...localStorage }; - console.log(storage); const headerValue = JSON.stringify({ 'power': storage.power ?? 'on', 'breezewiki': storage.breezewiki ?? 'off' }); - console.log(headerValue); chrome.declarativeNetRequest.updateDynamicRules({ removeRuleIds: [1], addRules: [ @@ -122,10 +123,13 @@ function updateDeclarativeRule() { "antifandom.com", "bw.projectsegfau.lt", "breeze.hostux.net", - "breeze.777.tf", "breezewiki.pussthecat.org", "bw.vern.cc", - "breezewiki.esmailelbob.xyz" + "breezewiki.esmailelbob.xyz", + 'bw.artemislena.eu', + 'bw.hamstro.dev', + 'nerd.whatever.social', + 'breeze.nohost.network' ], "resourceTypes": [ "main_frame" @@ -147,7 +151,9 @@ function redirectToBreezeWiki(storage, eventInfo, url) { } else { chrome.tabs.update(eventInfo.tabId, { url: host + '/' + subdomain }); } - chrome.storage.sync.set({ 'countBreezeWiki': (storage.countBreezeWiki ?? 0) + 1 }); + if (eventInfo.frameId === 0) { + chrome.storage.sync.set({ 'countBreezeWiki': (storage.countBreezeWiki ?? 0) + 1 }); + } if ((storage.notifications ?? 'on') === 'on') { // Notify that user is being redirected to BreezeWiki let notifID = 'independent-wiki-redirector-notification-' + Math.floor(Math.random() * 1E16); @@ -309,8 +315,11 @@ async function main(eventInfo, eventName) { // Perform redirect: chrome.tabs.update(eventInfo.tabId, { url: newURL }); + // Increase global redirect count: - chrome.storage.sync.set({ 'countRedirects': (storage.countRedirects ?? 0) + 1 }); + if (eventInfo.frameId === 0) { + chrome.storage.sync.set({ 'countRedirects': (storage.countRedirects ?? 0) + 1 }); + } // Notify if enabled if ((storage.notifications ?? 'on') === 'on') { diff --git a/content.js b/content.js index 04b0159..a872961 100644 --- a/content.js +++ b/content.js @@ -1,7 +1,7 @@ const searchEngineRegex = /www\.google\.|duckduckgo\.com|www\.bing\.com|search\.brave\.com/; const fandomRegex = /\.fandom\.com$/; const fextraRegex = /\.fextralife\.com$/; -const breezeWikiRegex = /breeze\.777\.tf$|breeze\.hostux\.net$|bw\.projectsegfau\.lt$|antifandom\.com$|breezewiki\.pussthecat\.org$|bw\.vern\.cc$|breezewiki\.esmailelbob\.xyz$|bw\.artemislena\.eu$/; +const breezeWikiRegex = /breezewiki\.com$|breeze\.hostux\.net$|bw\.projectsegfau\.lt$|antifandom\.com$|breezewiki\.pussthecat\.org$|bw\.vern\.cc$|breezewiki\.esmailelbob\.xyz$|bw\.artemislena\.eu$|bw\.hamstro\.dev$|nerd\.whatever\.social$|breeze\.nohost\.network$/; const currentURL = new URL(document.location); // Create object prototypes for getting and setting attributes: diff --git a/manifest2.json b/manifest2.json index bfcb2e3..a2d8e50 100644 --- a/manifest2.json +++ b/manifest2.json @@ -12,11 +12,13 @@ "https://antifandom.com/*", "https://bw.projectsegfau.lt/*", "https://breeze.hostux.net/*", - "https://breeze.777.tf/*", "https://breezewiki.pussthecat.org/*", "https://bw.vern.cc/*", "https://breezewiki.esmailelbob.xyz/*", - "https://bw.artemislena.eu/*" + "https://bw.artemislena.eu/*", + "https://bw.hamstro.dev/*", + "https://nerd.whatever.social/*", + "https://breeze.nohost.network/*" ], "icons": { "16": "images/logo-16.png", @@ -59,11 +61,13 @@ "https://antifandom.com/*", "https://bw.projectsegfau.lt/*", "https://breeze.hostux.net/*", - "https://breeze.777.tf/*", "https://breezewiki.pussthecat.org/*", "https://bw.vern.cc/*", "https://breezewiki.esmailelbob.xyz/*", "https://bw.artemislena.eu/*", + "https://bw.hamstro.dev/*", + "https://nerd.whatever.social/*", + "https://breeze.nohost.network/*", "https://*.duckduckgo.com/*", "https://*.bing.com/search*", "https://search.brave.com/search*", diff --git a/manifest3.json b/manifest3.json index b5cd392..326fe75 100644 --- a/manifest3.json +++ b/manifest3.json @@ -43,11 +43,13 @@ "https://antifandom.com/*", "https://bw.projectsegfau.lt/*", "https://breeze.hostux.net/*", - "https://breeze.777.tf/*", "https://breezewiki.pussthecat.org/*", "https://bw.vern.cc/*", "https://breezewiki.esmailelbob.xyz/*", "https://bw.artemislena.eu/*", + "https://bw.hamstro.dev/*", + "https://nerd.whatever.social/*", + "https://breeze.nohost.network/*", "https://*.duckduckgo.com/*", "https://www.bing.com/*", "https://search.brave.com/*", @@ -256,11 +258,13 @@ "https://antifandom.com/*", "https://bw.projectsegfau.lt/*", "https://breeze.hostux.net/*", - "https://breeze.777.tf/*", "https://breezewiki.pussthecat.org/*", "https://bw.vern.cc/*", "https://breezewiki.esmailelbob.xyz/*", "https://bw.artemislena.eu/*", + "https://bw.hamstro.dev/*", + "https://nerd.whatever.social/*", + "https://breeze.nohost.network/*", "https://*.duckduckgo.com/*", "https://*.bing.com/search*", "https://search.brave.com/search*", @@ -466,11 +470,13 @@ "https://antifandom.com/*", "https://bw.projectsegfau.lt/*", "https://breeze.hostux.net/*", - "https://breeze.777.tf/*", "https://breezewiki.pussthecat.org/*", "https://bw.vern.cc/*", "https://breezewiki.esmailelbob.xyz/*", - "https://bw.artemislena.eu/*" + "https://bw.artemislena.eu/*", + "https://bw.hamstro.dev/*", + "https://nerd.whatever.social/*", + "https://breeze.nohost.network/*" ], "manifest_version": 3 } \ No newline at end of file