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

Commit

Permalink
update build scripts for HTTPS Everywhere 5.2.19
Browse files Browse the repository at this point in the history
once the built files are uploaded to AWS, this will fix #9649, #5634, and #9419
  • Loading branch information
diracdeltas committed Jun 21, 2017
1 parent 6bd4de0 commit acf967c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "standard",
"postinstall": "npm run download-sync-client && webpack",
"preload-httpse": "node ./preload-httpse.js",
"preload-httpse": "node ./tools/preloadHTTPSE.js",
"start-log": "node ./tools/start.js --user-data-dir=brave-development --enable-logging=stderr --v=1 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck",
"start": "node ./tools/start.js --user-data-dir=brave-development --enable-logging --v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck",
"start2": "node ./tools/start.js --user-data-dir=brave-development-2 --enable-logging --v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck",
Expand Down Expand Up @@ -166,8 +166,7 @@
"jsonfile": "^2.2.3",
"less": "^2.5.3",
"less-loader": "^2.2.1",
"level": "1.5.0",
"leveldown": "1.5.0",
"level": "^1.7.0",
"mkdirp": "^0.5.1",
"mocha": "^2.3.4",
"mockery": "^1.7.0",
Expand Down
35 changes: 2 additions & 33 deletions preload-httpse.js → tools/preloadHTTPSE.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
var fs = require('fs')
var path = require('path')
var parseString = require('xml2js').parseString
var sqlite3 = require('sqlite3')
var levelup = require('level')

// Manually exclude sites that are broken until they are fixed in the next
Expand All @@ -27,7 +26,8 @@ var exclusions = {
'IDownloadBlog.xml': 'breaks http://www.idownloadblog.com/',
'EBay_static.com.xml': 'breaks suggested product image previews',
'Cisco.xml': 'breaks http://www.cisco.com/c/m/en_us/training-events/events-webinars/techwise-tv/listings.html',
'GQ.xml': 'mixed content on gq.com'
'GQ.xml': 'mixed content on gq.com',
'Where_2_Get_It.xml': 'maps missing on http://us.coopertire.com/Customer-Care/Dealer-Locator.aspx?form=locator_search&addressline=92346'
}

var rulesets = JSON.parse(fs.readFileSync('rulesets.json', 'utf8'))
Expand All @@ -51,37 +51,6 @@ for (let id in rulesets.rulesetStrings) {
console.log('Writing httpse.json')
fs.writeFileSync('httpse.json', JSON.stringify(rulesets), 'utf8')

// Convert httpse.json to sqlite for mobile
console.log('creating httpse.sqlite')
var db = new sqlite3.Database('httpse.sqlite', function (err) {
if (err !== null) {
throw new Error('FATAL: could not open db: ' + err)
}

db.exec([
'DROP TABLE IF EXISTS rulesets',
'CREATE TABLE rulesets (id INTEGER PRIMARY KEY, contents TEXT)',
'DROP TABLE IF EXISTS targets',
'CREATE TABLE targets (host TEXT UNIQUE, ids TEXT)'].join('; '), function (err) {
if (err !== null) {
throw new Error('FATAL: could not create tables: ' + err)
}

var rulesetStatement = db.prepare('INSERT INTO rulesets (id, contents) VALUES(?, ?)')
var targetStatement = db.prepare('INSERT INTO targets (host, ids) VALUES(?, ?)')

// TODO: Speed this up
for (var id in rulesets.rulesetStrings) {
let contents = JSON.stringify(rulesets.rulesetStrings[id])
rulesetStatement.run(id, contents)
}
for (var target in rulesets.targets) {
let ids = JSON.stringify(rulesets.targets[target])
targetStatement.run(target, ids)
}
})
})

const rmDir = function (dirPath) {
try {
var files = fs.readdirSync(dirPath)
Expand Down

0 comments on commit acf967c

Please sign in to comment.