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

Commit

Permalink
Use ad-block 3.0 (w/ html filtering parsing)
Browse files Browse the repository at this point in the history
Fix #8398
  • Loading branch information
bbondy committed Apr 20, 2017
1 parent c719806 commit b6bae09
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

3 comments on commit b6bae09

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbondy should this be cherry picked into 0.15.0?

@bbondy
Copy link
Member Author

@bbondy bbondy commented on b6bae09 Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

@luixxiul
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change of npm-shrinkwrap.json clean install fails due to an error. After reverting the file, clean installing, and undo reverting, npm i works.

Please sign in to comment.