From 15a921daa22e11d3bbead26d9e9f43e126354225 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 20 Oct 2017 04:16:26 -0400 Subject: [PATCH] Use ad-block and TP from muon Related to: https://github.com/brave/browser-laptop/issues/11352 --- app/adBlock.js | 6 +++--- app/browser/tabs.js | 2 +- package-lock.json | 32 -------------------------------- package.json | 2 -- 4 files changed, 4 insertions(+), 38 deletions(-) diff --git a/app/adBlock.js b/app/adBlock.js index 1da6c60118b..d27a9a114f0 100644 --- a/app/adBlock.js +++ b/app/adBlock.js @@ -5,7 +5,7 @@ 'use strict' const urlParse = require('./common/urlParse') -const {adBlockDataFileVersion, AdBlockClient} = require('ad-block') +const {adBlockDataFileVersion, adBlockLists, AdBlockClient} = require('ad-block') const dataFile = require('./dataFile') const Filtering = require('./filtering') const appConfig = require('../js/constants/appConfig') @@ -14,7 +14,6 @@ const debounce = require('../js/lib/debounce') const adblockInstances = new Map() const defaultAdblock = new AdBlockClient() const defaultSafeBrowsing = new AdBlockClient() -const regions = require('ad-block/lib/regions') const getSetting = require('../js/settings').getSetting const {ADBLOCK_CUSTOM_RULES} = require('../js/constants/settings') const customFilterRulesUUID = 'CE61F035-9F0A-4999-9A5A-D4E46AF676F7' @@ -67,7 +66,8 @@ module.exports.init = () => { .initInstance(defaultAdblock, module.exports.adBlockResourceName, false) .initInstance(defaultSafeBrowsing, module.exports.safeBrowsingResourceName, true) // Initialize the regional adblock files that are enabled - regions + adBlockLists + .regions .filter((region) => getSetting(`adblock.${region.uuid}.enabled`)) .forEach((region) => module.exports.updateAdblockDataFiles(region.uuid, true)) const customRules = getSetting(ADBLOCK_CUSTOM_RULES) diff --git a/app/browser/tabs.js b/app/browser/tabs.js index f835fc8fcfc..456db4093fe 100644 --- a/app/browser/tabs.js +++ b/app/browser/tabs.js @@ -254,7 +254,7 @@ const updateAboutDetails = (tabId) => { sendAboutDetails(tabId, messages.ADBLOCK_UPDATED, { adblock: adblock.toJS(), settings: appSettings.toJS(), - resources: require('ad-block/lib/regions') + resources: require('ad-block').adBlockLists.regions }) } else if (location === 'about:downloads') { const downloads = appState.get('downloads', Immutable.Map()) diff --git a/package-lock.json b/package-lock.json index 5fba67dd742..4a3432538a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,17 +93,6 @@ "acorn": "3.2.0" } }, - "ad-block": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/ad-block/-/ad-block-3.0.5.tgz", - "integrity": "sha512-PXpwgqjvEqu3JhUzZ4bp0mp7CDtdODkKAKrAZI07aHaAOTe2Z/b7QlK86NUqcuL2jqwUu7u7/Z79qg5IJV19xw==", - "requires": { - "bloom-filter-cpp": "1.1.6", - "cppunitlite": "1.0.0", - "hashset-cpp": "1.0.17", - "nan": "2.7.0" - } - }, "addr-to-ip-port": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/addr-to-ip-port/-/addr-to-ip-port-1.4.2.tgz", @@ -2048,11 +2037,6 @@ "superagent": "1.8.5" } }, - "bloom-filter-cpp": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/bloom-filter-cpp/-/bloom-filter-cpp-1.1.6.tgz", - "integrity": "sha1-3fAwWSOt9u2sG/QJ5nNeGW0srL8=" - }, "bluebird": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", @@ -7640,11 +7624,6 @@ "minimalistic-assert": "1.0.0" } }, - "hashset-cpp": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/hashset-cpp/-/hashset-cpp-1.0.17.tgz", - "integrity": "sha1-PFkR8Lf48tB4TJzO1OppaTROTIc=" - }, "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", @@ -17649,17 +17628,6 @@ "punycode": "2.1.0" } }, - "tracking-protection": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/tracking-protection/-/tracking-protection-1.1.6.tgz", - "integrity": "sha1-QTTZKjo3/JmKIlmXTSd3yK9DYLA=", - "requires": { - "cppunitlite": "1.0.0", - "hashset-cpp": "1.0.17", - "mkdirp": "0.5.1", - "nan": "2.7.0" - } - }, "traverse": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", diff --git a/package.json b/package.json index 8a8e6b79079..04f343f9fb8 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,6 @@ "homepage": "https://www.brave.com/", "dependencies": { "acorn": "3.2.0", - "ad-block": "3.0.5", "aphrodite": "1.1.0", "async": "^2.0.1", "bat-balance": "^1.0.3", @@ -122,7 +121,6 @@ "string.prototype.startswith": "^0.2.0", "tablesort": "5.0.1", "tldjs": "1.6.2", - "tracking-protection": "1.1.x", "underscore": "1.8.3", "url-loader": "~0.6.2", "webtorrent-remote": "^2.0.2"