Updating BreezeWiki hosts + fixing dupe counts

pull/161/head^2
Kevin Payravi 2023-06-27 03:12:42 -05:00
parent 1a89177d44
commit 950ab269aa
4 changed files with 35 additions and 16 deletions

View File

@ -44,10 +44,13 @@ if (chrome.declarativeNetRequest) {
'*://antifandom.com/*', '*://antifandom.com/*',
'*://bw.projectsegfau.lt/*', '*://bw.projectsegfau.lt/*',
'*://breeze.hostux.net/*', '*://breeze.hostux.net/*',
'*://breeze.777.tf/*',
'*://breezewiki.pussthecat.org/*', '*://breezewiki.pussthecat.org/*',
'*://bw.vern.cc/*', '*://bw.vern.cc/*',
'*://breezewiki.esmailelbob.xyz/*' '*://breezewiki.esmailelbob.xyz/*',
'*://bw.artemislena.eu/*',
'*://bw.hamstro.dev/*',
'*://nerd.whatever.social/*',
'*://breeze.nohost.network/*'
], ],
types: [ types: [
'main_frame' 'main_frame'
@ -94,12 +97,10 @@ function updateDeclarativeRule() {
chrome.storage.local.get(function (localStorage) { chrome.storage.local.get(function (localStorage) {
chrome.storage.sync.get(function (syncStorage) { chrome.storage.sync.get(function (syncStorage) {
const storage = { ...syncStorage, ...localStorage }; const storage = { ...syncStorage, ...localStorage };
console.log(storage);
const headerValue = JSON.stringify({ const headerValue = JSON.stringify({
'power': storage.power ?? 'on', 'power': storage.power ?? 'on',
'breezewiki': storage.breezewiki ?? 'off' 'breezewiki': storage.breezewiki ?? 'off'
}); });
console.log(headerValue);
chrome.declarativeNetRequest.updateDynamicRules({ chrome.declarativeNetRequest.updateDynamicRules({
removeRuleIds: [1], removeRuleIds: [1],
addRules: [ addRules: [
@ -122,10 +123,13 @@ function updateDeclarativeRule() {
"antifandom.com", "antifandom.com",
"bw.projectsegfau.lt", "bw.projectsegfau.lt",
"breeze.hostux.net", "breeze.hostux.net",
"breeze.777.tf",
"breezewiki.pussthecat.org", "breezewiki.pussthecat.org",
"bw.vern.cc", "bw.vern.cc",
"breezewiki.esmailelbob.xyz" "breezewiki.esmailelbob.xyz",
'bw.artemislena.eu',
'bw.hamstro.dev',
'nerd.whatever.social',
'breeze.nohost.network'
], ],
"resourceTypes": [ "resourceTypes": [
"main_frame" "main_frame"
@ -147,7 +151,9 @@ function redirectToBreezeWiki(storage, eventInfo, url) {
} else { } else {
chrome.tabs.update(eventInfo.tabId, { url: host + '/' + subdomain }); 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') { if ((storage.notifications ?? 'on') === 'on') {
// Notify that user is being redirected to BreezeWiki // Notify that user is being redirected to BreezeWiki
let notifID = 'independent-wiki-redirector-notification-' + Math.floor(Math.random() * 1E16); let notifID = 'independent-wiki-redirector-notification-' + Math.floor(Math.random() * 1E16);
@ -309,8 +315,11 @@ async function main(eventInfo, eventName) {
// Perform redirect: // Perform redirect:
chrome.tabs.update(eventInfo.tabId, { url: newURL }); chrome.tabs.update(eventInfo.tabId, { url: newURL });
// Increase global redirect count: // 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 // Notify if enabled
if ((storage.notifications ?? 'on') === 'on') { if ((storage.notifications ?? 'on') === 'on') {

View File

@ -1,7 +1,7 @@
const searchEngineRegex = /www\.google\.|duckduckgo\.com|www\.bing\.com|search\.brave\.com/; const searchEngineRegex = /www\.google\.|duckduckgo\.com|www\.bing\.com|search\.brave\.com/;
const fandomRegex = /\.fandom\.com$/; const fandomRegex = /\.fandom\.com$/;
const fextraRegex = /\.fextralife\.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); const currentURL = new URL(document.location);
// Create object prototypes for getting and setting attributes: // Create object prototypes for getting and setting attributes:

View File

@ -12,11 +12,13 @@
"https://antifandom.com/*", "https://antifandom.com/*",
"https://bw.projectsegfau.lt/*", "https://bw.projectsegfau.lt/*",
"https://breeze.hostux.net/*", "https://breeze.hostux.net/*",
"https://breeze.777.tf/*",
"https://breezewiki.pussthecat.org/*", "https://breezewiki.pussthecat.org/*",
"https://bw.vern.cc/*", "https://bw.vern.cc/*",
"https://breezewiki.esmailelbob.xyz/*", "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": { "icons": {
"16": "images/logo-16.png", "16": "images/logo-16.png",
@ -59,11 +61,13 @@
"https://antifandom.com/*", "https://antifandom.com/*",
"https://bw.projectsegfau.lt/*", "https://bw.projectsegfau.lt/*",
"https://breeze.hostux.net/*", "https://breeze.hostux.net/*",
"https://breeze.777.tf/*",
"https://breezewiki.pussthecat.org/*", "https://breezewiki.pussthecat.org/*",
"https://bw.vern.cc/*", "https://bw.vern.cc/*",
"https://breezewiki.esmailelbob.xyz/*", "https://breezewiki.esmailelbob.xyz/*",
"https://bw.artemislena.eu/*", "https://bw.artemislena.eu/*",
"https://bw.hamstro.dev/*",
"https://nerd.whatever.social/*",
"https://breeze.nohost.network/*",
"https://*.duckduckgo.com/*", "https://*.duckduckgo.com/*",
"https://*.bing.com/search*", "https://*.bing.com/search*",
"https://search.brave.com/search*", "https://search.brave.com/search*",

View File

@ -43,11 +43,13 @@
"https://antifandom.com/*", "https://antifandom.com/*",
"https://bw.projectsegfau.lt/*", "https://bw.projectsegfau.lt/*",
"https://breeze.hostux.net/*", "https://breeze.hostux.net/*",
"https://breeze.777.tf/*",
"https://breezewiki.pussthecat.org/*", "https://breezewiki.pussthecat.org/*",
"https://bw.vern.cc/*", "https://bw.vern.cc/*",
"https://breezewiki.esmailelbob.xyz/*", "https://breezewiki.esmailelbob.xyz/*",
"https://bw.artemislena.eu/*", "https://bw.artemislena.eu/*",
"https://bw.hamstro.dev/*",
"https://nerd.whatever.social/*",
"https://breeze.nohost.network/*",
"https://*.duckduckgo.com/*", "https://*.duckduckgo.com/*",
"https://www.bing.com/*", "https://www.bing.com/*",
"https://search.brave.com/*", "https://search.brave.com/*",
@ -256,11 +258,13 @@
"https://antifandom.com/*", "https://antifandom.com/*",
"https://bw.projectsegfau.lt/*", "https://bw.projectsegfau.lt/*",
"https://breeze.hostux.net/*", "https://breeze.hostux.net/*",
"https://breeze.777.tf/*",
"https://breezewiki.pussthecat.org/*", "https://breezewiki.pussthecat.org/*",
"https://bw.vern.cc/*", "https://bw.vern.cc/*",
"https://breezewiki.esmailelbob.xyz/*", "https://breezewiki.esmailelbob.xyz/*",
"https://bw.artemislena.eu/*", "https://bw.artemislena.eu/*",
"https://bw.hamstro.dev/*",
"https://nerd.whatever.social/*",
"https://breeze.nohost.network/*",
"https://*.duckduckgo.com/*", "https://*.duckduckgo.com/*",
"https://*.bing.com/search*", "https://*.bing.com/search*",
"https://search.brave.com/search*", "https://search.brave.com/search*",
@ -466,11 +470,13 @@
"https://antifandom.com/*", "https://antifandom.com/*",
"https://bw.projectsegfau.lt/*", "https://bw.projectsegfau.lt/*",
"https://breeze.hostux.net/*", "https://breeze.hostux.net/*",
"https://breeze.777.tf/*",
"https://breezewiki.pussthecat.org/*", "https://breezewiki.pussthecat.org/*",
"https://bw.vern.cc/*", "https://bw.vern.cc/*",
"https://breezewiki.esmailelbob.xyz/*", "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 "manifest_version": 3
} }