From ca3a8ee78c33bfc8dd04e43efe686d56e717dace Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 27 Oct 2016 14:14:58 -0400 Subject: [PATCH] Update Master Password Web version to support all algorithm versions and Tom's latest mpw-js. --- .gitmodules | 4 +- MasterPassword/Web/.gitignore | 1 + .../Web}/css/main.css | 3 + .../Web}/img/spinner.svg | 0 .../mpw-js => MasterPassword/Web}/index.html | 6 + MasterPassword/Web/js/Makefile | 15 +++ MasterPassword/Web/js/README.md | 8 ++ .../Web}/js/dependencies.js | 34 +++--- .../Web}/js/encoding-polyfill.js | 0 .../mpw-js => MasterPassword/Web}/js/main.js | 105 ++++++++++-------- {Site/mpw-js => MasterPassword/Web}/js/mpw-js | 0 .../Web}/js/promise-polyfill.js | 0 .../Web}/js/setImmediate-polyfill.js | 2 +- .../Web}/js/typedarray-polyfill.js | 0 .../Web}/js/vendor/jquery-2.1.1.js | 0 .../Web}/js/vendor/jquery-2.1.1.min.js | 0 .../Web}/js/vendor/jquery-2.1.1.min.map | 0 {Site/mpw-js => MasterPassword/Web}/sync | 0 18 files changed, 107 insertions(+), 71 deletions(-) create mode 100644 MasterPassword/Web/.gitignore rename {Site/mpw-js => MasterPassword/Web}/css/main.css (97%) rename {Site/mpw-js => MasterPassword/Web}/img/spinner.svg (100%) rename {Site/mpw-js => MasterPassword/Web}/index.html (92%) create mode 100644 MasterPassword/Web/js/Makefile create mode 100644 MasterPassword/Web/js/README.md rename {Site/mpw-js => MasterPassword/Web}/js/dependencies.js (81%) rename {Site/mpw-js => MasterPassword/Web}/js/encoding-polyfill.js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/main.js (63%) rename {Site/mpw-js => MasterPassword/Web}/js/mpw-js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/promise-polyfill.js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/setImmediate-polyfill.js (99%) rename {Site/mpw-js => MasterPassword/Web}/js/typedarray-polyfill.js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/vendor/jquery-2.1.1.js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/vendor/jquery-2.1.1.min.js (100%) rename {Site/mpw-js => MasterPassword/Web}/js/vendor/jquery-2.1.1.min.map (100%) rename {Site/mpw-js => MasterPassword/Web}/sync (100%) diff --git a/.gitmodules b/.gitmodules index c38f79b5..97e7797f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,6 +16,6 @@ [submodule "External/jrswizzle"] path = External/jrswizzle url = git://github.com/jonmarimba/jrswizzle.git -[submodule "Site/mpw-js/js/mpw-js"] - path = Site/mpw-js/js/mpw-js +[submodule "MasterPassword/Web/js/mpw-js"] + path = MasterPassword/Web/js/mpw-js url = https://github.com/tmthrgd/mpw-js.git diff --git a/MasterPassword/Web/.gitignore b/MasterPassword/Web/.gitignore new file mode 100644 index 00000000..c6a34495 --- /dev/null +++ b/MasterPassword/Web/.gitignore @@ -0,0 +1 @@ +js/es5 diff --git a/Site/mpw-js/css/main.css b/MasterPassword/Web/css/main.css similarity index 97% rename from Site/mpw-js/css/main.css rename to MasterPassword/Web/css/main.css index 336855b9..a2682372 100644 --- a/Site/mpw-js/css/main.css +++ b/MasterPassword/Web/css/main.css @@ -60,6 +60,9 @@ input:focus, select:focus { input.half, select.half { width: 33%; } +input.minimal, select.minimal { + width: auto; +} input[type="submit"], input[type="image"] { background: transparent; border: none; diff --git a/Site/mpw-js/img/spinner.svg b/MasterPassword/Web/img/spinner.svg similarity index 100% rename from Site/mpw-js/img/spinner.svg rename to MasterPassword/Web/img/spinner.svg diff --git a/Site/mpw-js/index.html b/MasterPassword/Web/index.html similarity index 92% rename from Site/mpw-js/index.html rename to MasterPassword/Web/index.html index 6bc28255..1d7c2dea 100644 --- a/Site/mpw-js/index.html +++ b/MasterPassword/Web/index.html @@ -22,6 +22,12 @@

+

diff --git a/MasterPassword/Web/js/Makefile b/MasterPassword/Web/js/Makefile new file mode 100644 index 00000000..d2a2e2a2 --- /dev/null +++ b/MasterPassword/Web/js/Makefile @@ -0,0 +1,15 @@ +build: mkdir-es5 es5/mpw-js/pbkdf2.js es5/mpw-js/scrypt.js es5/mpw-js/mpw.js es5/setImmediate-polyfill.js + +mkdir-es5: + mkdir -p es5 + mkdir -p es5/mpw-js + +es5/%: $* + babel $* -o $@ --presets es2015 --source-maps + +clean: + rm -rf es5 2>/dev/null + +update: + git submodule update --init --recursive + git submodule foreach git pull origin master diff --git a/MasterPassword/Web/js/README.md b/MasterPassword/Web/js/README.md new file mode 100644 index 00000000..26ed7468 --- /dev/null +++ b/MasterPassword/Web/js/README.md @@ -0,0 +1,8 @@ +ES5 +=== + +If your browser does not support ECMAScript 6, you will need to run babel to compile an ES5-compatible version of the ES6 mpw-js code. + +1. Install npm. On OS X, you can use `brew install npm`. +2. Install babel. With npm installed, you can use `npm -g install babel-cli babel-preset-es2015` +3. Build the ES5-translation of the ES6 code. From this directory, just run `make`. diff --git a/Site/mpw-js/js/dependencies.js b/MasterPassword/Web/js/dependencies.js similarity index 81% rename from Site/mpw-js/js/dependencies.js rename to MasterPassword/Web/js/dependencies.js index 78b23676..a45fd67d 100644 --- a/Site/mpw-js/js/dependencies.js +++ b/MasterPassword/Web/js/dependencies.js @@ -1,3 +1,13 @@ +// Test for required ES6 features +// Use an eval call to avoid a hard-fail on ES5 parsers. +var ES6 = false; +var esdir = "es5/"; +try { + // Use ES6 code if the ES6 class, let, destructive assignment and rest arguments are supported. + eval("class $ES6 { constructor() { let b = true; this.b = b; } } var [ES6, esdir] = ((...args) => args)(new $ES6().b, '')"); +} catch (e) { +} + // If crypto.subtle is not supported, try crypto.webkitSubtle instead. if (window.crypto && !window.crypto.subtle && window.crypto.webkitSubtle) window.crypto.subtle = window.crypto.webkitSubtle; @@ -12,9 +22,8 @@ if (!window.crypto || !window.crypto.subtle) { document.write("