From ed03b89e266ab25444d69f23e5f9f0070f0080d7 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 11 Oct 2016 14:32:03 -0700 Subject: Move tos hash logic to build phase. Create dynamic global variables based on build. --- gulpfile.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 9f1acbf67..26ad0c1f8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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 -- cgit