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

feature/default_network_editable
Kevin Serrano 8 years ago
parent 89780bd22a
commit ed03b89e26
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
  1. 3
      app/scripts/config.js
  2. 9
      gulpfile.js
  3. 1
      package.json
  4. 2
      ui/app/store.js

@ -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: {

@ -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

@ -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",

@ -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

Loading…
Cancel
Save