Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8406 from brave/ad-block-3
Browse files Browse the repository at this point in the history
Use ad-block 3.0 (w/ html filtering parsing)
  • Loading branch information
bbondy committed Apr 20, 2017
2 parents 6ed7739 + b6bae09 commit 15b4dbc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/adBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const registerAppConfigForResource = (uuid, enabled, version) => {
* @param uuid - The uuid of the adblock datafile resource
* @param forAdblock - true if main frame URLs should be blocked
*/
module.exports.updateAdblockDataFiles = (uuid, enabled, version = 2, shouldCheckMainFrame = false) => {
module.exports.updateAdblockDataFiles = (uuid, enabled, version = Number(appConfig.adblock.version), shouldCheckMainFrame = false) => {
registerAppConfigForResource(uuid, enabled, version)
if (!adblockInstances.has(uuid)) {
const adBlockClient = new AdBlockClient()
Expand Down
5 changes: 3 additions & 2 deletions app/dataFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ module.exports.init = (resourceName, startExtension, onInitDone, forceDownload)
const version = appConfig[resourceName].version

let versionFolder = version
if (process.env.NODE_ENV === 'development' && resourceName === appConfig.resourceNames.ADBLOCK) {
versionFolder = 'test'
const hasStagedDatFile = [appConfig.resourceNames.ADBLOCK, appConfig.resourceNames.SAFE_BROWSING].includes(resourceName)
if (process.env.NODE_ENV === 'development' && hasStagedDatFile) {
versionFolder = `test/${versionFolder}`
}
const url = appConfig[resourceName].url.replace('{version}', versionFolder)

Expand Down
5 changes: 3 additions & 2 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const adHost = process.env.AD_HOST || 'https://oip.brave.com'
const buildConfig = require('./buildConfig')
const isProduction = buildConfig.nodeEnv === 'production'
const {fullscreenOption} = require('../../app/common/constants/settingsEnums')
const ABPDatVersion = '3'

module.exports = {
name: 'Brave',
Expand Down Expand Up @@ -56,13 +57,13 @@ module.exports = {
adblock: {
alternateDataFiles: 'https://s3.amazonaws.com/adblock-data/{version}/{uuid}.dat',
url: 'https://s3.amazonaws.com/adblock-data/{version}/ABPFilterParserData.dat',
version: '2',
version: ABPDatVersion,
msBetweenRechecks: 1000 * 60 * 60 * 2, // 2 hours
enabled: true
},
safeBrowsing: {
url: 'https://s3.amazonaws.com/adblock-data/{version}/SafeBrowsingData.dat',
version: '2',
version: ABPDatVersion,
msBetweenRechecks: 1000 * 60 * 60 * 2, // 2 hours
enabled: true
},
Expand Down
6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"homepage": "https://www.brave.com/",
"dependencies": {
"acorn": "3.2.0",
"ad-block": "^2.0.0",
"ad-block": "^3.0.0",
"aphrodite": "^1.0.0",
"async": "^2.0.1",
"clipboard-copy": "^1.0.0",
Expand Down

0 comments on commit 15b4dbc

Please sign in to comment.