1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Move tos hash logic to build phase. Create dynamic global variables based on build.

This commit is contained in:
Kevin Serrano 2016-10-11 14:32:03 -07:00
parent 89780bd22a
commit ed03b89e26
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
4 changed files with 12 additions and 3 deletions

View File

@ -2,7 +2,8 @@ const MAINET_RPC_URL = 'https://mainnet.infura.io/metamask'
const TESTNET_RPC_URL = 'https://morden.infura.io/metamask'
const DEFAULT_RPC_URL = TESTNET_RPC_URL
global.METAMASK_DEBUG = false
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
global.TOS_HASH = 'GULP_TOS_HASH'
module.exports = {
network: {

View File

@ -18,8 +18,15 @@ var path = require('path')
var manifest = require('./app/manifest.json')
var gulpif = require('gulp-if')
var replace = require('gulp-replace')
var disclaimer = fs.readFileSync(path.join(__dirname, 'USER_AGREEMENT.md')).toString()
var crypto = require('crypto')
var hash = crypto.createHash('sha256')
hash.update(disclaimer)
var tosHash = hash.digest('hex')
var disableLiveReload = gutil.env.disableLiveReload
var debug = gutil.env.debug
// browser reload
@ -237,6 +244,8 @@ function bundleTask(opts) {
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source(opts.filename))
.pipe(brfs())
.pipe(replace('GULP_TOS_HASH', tosHash))
.pipe(replace('\'GULP_METAMASK_DEBUG\'', debug))
// optional, remove if you don't need to buffer file contents
.pipe(buffer())
// optional, remove if you dont want sourcemaps

View File

@ -77,7 +77,6 @@
"redux-thunk": "^1.0.2",
"request-promise": "^4.1.1",
"sandwich-expando": "^1.0.5",
"string-hash": "^1.1.0",
"textarea-caret": "^3.0.1",
"three.js": "^0.73.2",
"through2": "^2.0.1",

View File

@ -4,7 +4,7 @@ const thunkMiddleware = require('redux-thunk')
const rootReducer = require('./reducers')
const createLogger = require('redux-logger')
global.METAMASK_DEBUG = false
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
module.exports = configureStore