summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jordan Johnson-Doyle <jordan@doyle.la> 2019-03-17 15:17:52 +0000
committerGravatar Jordan Johnson-Doyle <jordan@doyle.la> 2019-03-17 15:17:52 +0000
commitcf4496169fbc92588a25d1598ef47c3ebd6ce52a (patch)
treecd9b1879c40017794029c3258087f2a5f0f685cc
parentc28127d96a2a50b0bd6db863a7932c2dcb847490 (diff)
Implement a nice UI for manually approving Keybase users
-rw-r--r--manifest.json5
-rw-r--r--package-lock.json396
-rw-r--r--package.json8
-rw-r--r--src/content/ScriptInterceptor.ts53
-rw-r--r--src/options/index.html12
-rw-r--r--src/options/js/index.tsx1
-rw-r--r--src/popup/index.html12
-rw-r--r--src/popup/js/App.tsx2
-rw-r--r--src/popup/js/pages/Index.tsx146
-rw-r--r--webpack.config.js114
10 files changed, 617 insertions, 132 deletions
diff --git a/manifest.json b/manifest.json
index f29a6f0..6d8e25f 100644
--- a/manifest.json
+++ b/manifest.json
@@ -7,6 +7,7 @@
{
"matches": ["<all_urls>"],
"js": [
+ "dist/vendors~content.js",
"dist/content.js"
],
"all_frames": true,
@@ -16,10 +17,10 @@
"browser_action": {
"browser_style": true,
"default_title": "CryptoScript",
- "default_popup": "src/popup/index.html"
+ "default_popup": "dist/popup.html"
},
"options_ui": {
- "page": "src/options/index.html"
+ "page": "dist/options.html"
},
"browser_specific_settings": {
"gecko": {
diff --git a/package-lock.json b/package-lock.json
index 4082169..d760e90 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -732,6 +732,12 @@
"string-width": "^2.0.0"
}
},
+ "ansi-colors": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz",
+ "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==",
+ "dev": true
+ },
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
@@ -1568,6 +1574,16 @@
"integrity": "sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==",
"dev": true
},
+ "camel-case": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz",
+ "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=",
+ "dev": true,
+ "requires": {
+ "no-case": "^2.2.0",
+ "upper-case": "^1.1.1"
+ }
+ },
"camelcase": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.2.0.tgz",
@@ -2284,6 +2300,23 @@
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz",
"integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q=="
},
+ "clean-css": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz",
+ "integrity": "sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==",
+ "dev": true,
+ "requires": {
+ "source-map": "~0.6.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ }
+ }
+ },
"cli-boxes": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz",
@@ -2510,6 +2543,42 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
"dev": true
},
+ "copy-webpack-plugin": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.0.1.tgz",
+ "integrity": "sha512-yMTURAkYZO/6h6pGMbHQl2jpKtRNC+0Cy/4kRRP6qUHmpbGGAzNnyMecE6aHgGFCb4ksrL3YcDqYGb8ds3J9cw==",
+ "dev": true,
+ "requires": {
+ "cacache": "^11.3.1",
+ "find-cache-dir": "^2.0.0",
+ "glob-parent": "^3.1.0",
+ "globby": "^7.1.1",
+ "is-glob": "^4.0.0",
+ "loader-utils": "^1.1.0",
+ "minimatch": "^3.0.4",
+ "normalize-path": "^3.0.0",
+ "p-limit": "^2.1.0",
+ "serialize-javascript": "^1.4.0",
+ "webpack-log": "^2.0.0"
+ },
+ "dependencies": {
+ "is-glob": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz",
+ "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true
+ }
+ }
+ },
"core-js": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz",
@@ -2811,6 +2880,15 @@
"clone": "^1.0.2"
}
},
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
"define-property": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
@@ -2897,6 +2975,26 @@
"randombytes": "^2.0.0"
}
},
+ "dir-glob": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
+ "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==",
+ "dev": true,
+ "requires": {
+ "path-type": "^3.0.0"
+ },
+ "dependencies": {
+ "path-type": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
+ "dev": true,
+ "requires": {
+ "pify": "^3.0.0"
+ }
+ }
+ }
+ },
"dispensary": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/dispensary/-/dispensary-0.30.0.tgz",
@@ -2949,6 +3047,15 @@
"esutils": "^2.0.2"
}
},
+ "dom-converter": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
+ "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==",
+ "dev": true,
+ "requires": {
+ "utila": "~0.4"
+ }
+ },
"dom-helpers": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.4.0.tgz",
@@ -3133,6 +3240,31 @@
"is-arrayish": "^0.2.1"
}
},
+ "es-abstract": {
+ "version": "1.13.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
+ "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.0",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "is-callable": "^1.1.4",
+ "is-regex": "^1.0.4",
+ "object-keys": "^1.0.12"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
+ "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
"es5-ext": {
"version": "0.10.49",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz",
@@ -4255,6 +4387,12 @@
"rimraf": "2"
}
},
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
@@ -4521,6 +4659,28 @@
"integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==",
"dev": true
},
+ "globby": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz",
+ "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=",
+ "dev": true,
+ "requires": {
+ "array-union": "^1.0.1",
+ "dir-glob": "^2.0.0",
+ "glob": "^7.1.2",
+ "ignore": "^3.3.5",
+ "pify": "^3.0.0",
+ "slash": "^1.0.0"
+ },
+ "dependencies": {
+ "ignore": {
+ "version": "3.3.10",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
+ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
+ "dev": true
+ }
+ }
+ },
"globule": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz",
@@ -4598,6 +4758,15 @@
"har-schema": "^2.0.0"
}
},
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
@@ -4627,6 +4796,12 @@
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
+ "has-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
+ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
+ "dev": true
+ },
"has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
@@ -4685,6 +4860,12 @@
"minimalistic-assert": "^1.0.1"
}
},
+ "he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true
+ },
"history": {
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/history/-/history-4.9.0.tgz",
@@ -4729,6 +4910,49 @@
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
"dev": true
},
+ "html-minifier": {
+ "version": "3.5.21",
+ "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz",
+ "integrity": "sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==",
+ "dev": true,
+ "requires": {
+ "camel-case": "3.0.x",
+ "clean-css": "4.2.x",
+ "commander": "2.17.x",
+ "he": "1.2.x",
+ "param-case": "2.1.x",
+ "relateurl": "0.2.x",
+ "uglify-js": "3.4.x"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "2.17.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
+ "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
+ "dev": true
+ }
+ }
+ },
+ "html-webpack-plugin": {
+ "version": "4.0.0-beta.5",
+ "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.5.tgz",
+ "integrity": "sha512-y5l4lGxOW3pz3xBTFdfB9rnnrWRPVxlAhX6nrBYIcW+2k2zC3mSp/3DxlWVCMBfnO6UAnoF8OcFn0IMy6kaKAQ==",
+ "dev": true,
+ "requires": {
+ "html-minifier": "^3.5.20",
+ "loader-utils": "^1.1.0",
+ "lodash": "^4.17.11",
+ "pretty-error": "^2.1.1",
+ "tapable": "^1.1.0",
+ "util.promisify": "1.0.0"
+ }
+ },
+ "html-webpack-template": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/html-webpack-template/-/html-webpack-template-6.2.0.tgz",
+ "integrity": "sha512-wyzIjbe9yXGyQ6yAeFjWmku7YOlW85w1dxqLnAQ564uRNNoBhpZVTQl7ouROoyQrfZUSoPUJiw7oWn31NDiuQQ==",
+ "dev": true
+ },
"htmlparser2": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
@@ -5041,6 +5265,12 @@
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
+ "is-callable": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
+ "dev": true
+ },
"is-data-descriptor": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
@@ -5061,6 +5291,12 @@
}
}
},
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true
+ },
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
@@ -5223,6 +5459,15 @@
"integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=",
"dev": true
},
+ "is-regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.1"
+ }
+ },
"is-relative": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz",
@@ -5246,6 +5491,15 @@
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
+ "is-symbol": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
+ "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.0"
+ }
+ },
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
@@ -5804,6 +6058,12 @@
"signal-exit": "^3.0.0"
}
},
+ "lower-case": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz",
+ "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=",
+ "dev": true
+ },
"lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
@@ -6246,6 +6506,15 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
+ "no-case": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
+ "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==",
+ "dev": true,
+ "requires": {
+ "lower-case": "^1.1.1"
+ }
+ },
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
@@ -6578,6 +6847,12 @@
}
}
},
+ "object-keys": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz",
+ "integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg==",
+ "dev": true
+ },
"object-visit": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
@@ -6587,6 +6862,16 @@
"isobject": "^3.0.0"
}
},
+ "object.getownpropertydescriptors": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
+ "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "es-abstract": "^1.5.1"
+ }
+ },
"object.pick": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
@@ -6761,6 +7046,15 @@
"readable-stream": "^2.1.5"
}
},
+ "param-case": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz",
+ "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=",
+ "dev": true,
+ "requires": {
+ "no-case": "^2.2.0"
+ }
+ },
"parent-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.0.tgz",
@@ -7083,6 +7377,16 @@
"integrity": "sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==",
"dev": true
},
+ "pretty-error": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz",
+ "integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=",
+ "dev": true,
+ "requires": {
+ "renderkid": "^2.0.1",
+ "utila": "~0.4"
+ }
+ },
"probe-image-size": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/probe-image-size/-/probe-image-size-4.0.0.tgz",
@@ -7578,6 +7882,12 @@
"jsesc": "~0.5.0"
}
},
+ "relateurl": {
+ "version": "0.2.7",
+ "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz",
+ "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=",
+ "dev": true
+ },
"relaxed-json": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/relaxed-json/-/relaxed-json-1.0.1.tgz",
@@ -7636,6 +7946,36 @@
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
"dev": true
},
+ "renderkid": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-2.0.3.tgz",
+ "integrity": "sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA==",
+ "dev": true,
+ "requires": {
+ "css-select": "^1.1.0",
+ "dom-converter": "^0.2",
+ "htmlparser2": "^3.3.0",
+ "strip-ansi": "^3.0.0",
+ "utila": "^0.4.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
"repeat-element": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
@@ -8325,6 +8665,12 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true
},
+ "slash": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
+ "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
+ "dev": true
+ },
"slice-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
@@ -9343,6 +9689,24 @@
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.19.tgz",
"integrity": "sha512-T3PVJ6uz8i0HzPxOF9SWzWAlfN/DavlpQqepn22xgve/5QecC+XMCAtmUNnY7C9StehaV6exjUCI801lOI7QlQ=="
},
+ "uglify-js": {
+ "version": "3.4.10",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz",
+ "integrity": "sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw==",
+ "dev": true,
+ "requires": {
+ "commander": "~2.19.0",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ }
+ }
+ },
"uint64be": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/uint64be/-/uint64be-1.0.1.tgz",
@@ -9491,6 +9855,12 @@
"xdg-basedir": "^3.0.0"
}
},
+ "upper-case": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz",
+ "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=",
+ "dev": true
+ },
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
@@ -9574,6 +9944,22 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
},
+ "util.promisify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
+ "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "object.getownpropertydescriptors": "^2.0.3"
+ }
+ },
+ "utila": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz",
+ "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=",
+ "dev": true
+ },
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
@@ -9922,6 +10308,16 @@
"yargs": "^12.0.5"
}
},
+ "webpack-log": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz",
+ "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==",
+ "dev": true,
+ "requires": {
+ "ansi-colors": "^3.0.0",
+ "uuid": "^3.3.2"
+ }
+ },
"webpack-sources": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz",
diff --git a/package.json b/package.json
index 0bb22e4..121c2e5 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,10 @@
"@types/react": "^16.8.8",
"@types/react-dom": "^16.8.2",
"@types/react-router-dom": "^4.3.1",
+ "copy-webpack-plugin": "^5.0.1",
"css-loader": "^1.0.1",
+ "html-webpack-plugin": "^4.0.0-beta.5",
+ "html-webpack-template": "^6.2.0",
"node-sass": "^4.11.0",
"prettier": "^1.16.4",
"sass-loader": "^7.1.0",
@@ -37,8 +40,9 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "build-w": "webpack --display-error-details --progress --colors -w",
- "build": "webpack --display-error-details --progress --colors",
+ "build-dev": "webpack --mode development --display-error-details --progress --colors",
+ "build-w": "webpack --mode development --display-error-details --progress --colors -w",
+ "build": "webpack --mode production --display-error-details --progress --colors",
"start": "web-ext run",
"fmt": "prettier --list-different {common,src,popup}/**/*.{ts,tsx}",
"lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish '{common,src,popup}/**/*.{ts,tsx}'",
diff --git a/src/content/ScriptInterceptor.ts b/src/content/ScriptInterceptor.ts
index 29b792d..484fbc4 100644
--- a/src/content/ScriptInterceptor.ts
+++ b/src/content/ScriptInterceptor.ts
@@ -5,8 +5,7 @@ import { GetKeybaseUserForDomainEvent, GetKeybaseUserForDomainResponse } from ".
import { IEvent } from "../common/IEvent";
import KeyRing from "./KeyRing";
import { fetch } from "./util";
-import { GetUsersAwaitingConsentEvent, GetUsersAwaitingConsentResponse, AllowUserEvent, DeniedUserEvent } from "../common/GetUsersAwaitingConsentEvent";
-import { Script } from "../common/Script";
+import { AllowUserEvent, DeniedUserEvent } from "../common/GetUsersAwaitingConsentEvent";
import { PendingSignerError } from "./PendingSignerError";
import { getConfig, ConfigKey } from "../common/config";
@@ -30,17 +29,15 @@ export default new class ScriptInterceptor implements EventListenerObject {
await keyRing.getBarredUsers(),
await keyRing.getPendingApproval()
);
- } else if (message.TYPE === GetUsersAwaitingConsentEvent.TYPE) {
- const event = message as GetUsersAwaitingConsentEvent;
- const keyRing = this.getKeyRingForDomain(event.domain);
- return new GetUsersAwaitingConsentResponse(await keyRing.getPendingApproval());
} else if (message.TYPE === AllowUserEvent.TYPE) {
const event = message as AllowUserEvent;
this.getKeyRingForDomain(event.domain).addTrustedUser(event.user);
+ this.updateBadgeCount();
await this.drainScriptQueue();
} else if (message.TYPE === DeniedUserEvent.TYPE) {
const event = message as DeniedUserEvent;
this.getKeyRingForDomain(event.domain).addBarredUser(event.user);
+ this.updateBadgeCount();
await this.drainScriptQueue();
}
});
@@ -77,6 +74,44 @@ export default new class ScriptInterceptor implements EventListenerObject {
}, 10);
}
+ private async updateBadgeCount() {
+ /*const activeTab = await browser.runtime.sendMessage(new GetTabEvent());
+ const domain = new URL(activeTab.url).host;
+
+ const keyRing = this.getKeyRingForDomain(domain);
+
+ if ((await keyRing.getPendingApproval()).length > 0) {
+ browser.browserAction.setBadgeText({
+ text: '' + (await keyRing.getPendingApproval()).length,
+ tabId: activeTab.id
+ });
+ browser.browserAction.setBadgeBackgroundColor({
+ color: indigo[700],
+ tabId: activeTab.id
+ });
+ } else if ((await keyRing.getBarredUsers()).length > 0) {
+ browser.browserAction.setBadgeText({
+ text: '' + (await keyRing.getBarredUsers()).length,
+ tabId: activeTab.id
+ });
+ browser.browserAction.setBadgeBackgroundColor({
+ color: red[700],
+ tabId: activeTab.id
+ });
+ } else if ((await keyRing.getTrustedUsers()).length > 0) {
+ browser.browserAction.setBadgeText({
+ text: '' + (await keyRing.getTrustedUsers()).length,
+ tabId: activeTab.id
+ });
+ browser.browserAction.setBadgeBackgroundColor({
+ color: green[700],
+ tabId: activeTab.id
+ });
+ } else {
+ browser.browserAction.setBadgeText({text: ''});
+ }*/
+ }
+
private async checkPermissionMaybeExecute(script: HTMLScriptElement) {
const scriptContent = await this.getScriptContent(script);
@@ -161,7 +196,11 @@ export default new class ScriptInterceptor implements EventListenerObject {
const keyRing = this.getKeyRingForDomain(domain);
- if (!(await keyRing.getKeybaseUsers()).length) {
+ const users = await keyRing.getKeybaseUsers();
+
+ this.updateBadgeCount();
+
+ if (!users.length) {
if (await this.getTreatmentForUnsignedDomain(domain)) {
return true;
} else {
diff --git a/src/options/index.html b/src/options/index.html
deleted file mode 100644
index 30d32a2..0000000
--- a/src/options/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
-</head>
-
-<body>
- <div id="app"></div>
-
- <script type="text/javascript" src="../../dist/options.js"></script>
-</body>
-</html>
diff --git a/src/options/js/index.tsx b/src/options/js/index.tsx
index 0f62d1d..44ff14c 100644
--- a/src/options/js/index.tsx
+++ b/src/options/js/index.tsx
@@ -1,5 +1,4 @@
import * as ReactDOM from "react-dom";
-import { HashRouter } from "react-router-dom";
import * as React from "react";
import { App } from "./App";
diff --git a/src/popup/index.html b/src/popup/index.html
deleted file mode 100644
index 51cd228..0000000
--- a/src/popup/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
-</head>
-
-<body>
- <div id="app"></div>
-
- <script type="text/javascript" src="../../dist/popup.js"></script>
-</body>
-</html>
diff --git a/src/popup/js/App.tsx b/src/popup/js/App.tsx
index 1aeeb65..b7a1be5 100644
--- a/src/popup/js/App.tsx
+++ b/src/popup/js/App.tsx
@@ -2,7 +2,7 @@ import * as React from "react";
import { HashRouter } from "react-router-dom";
import { Switch, Route } from "react-router-dom";
-import { Index } from "./pages/Index";
+import Index from "./pages/Index";
import { Users } from "./pages/Users";
import AppBar from '@material-ui/core/AppBar';
diff --git a/src/popup/js/pages/Index.tsx b/src/popup/js/pages/Index.tsx
index 4c1d3c8..0f1e808 100644
--- a/src/popup/js/pages/Index.tsx
+++ b/src/popup/js/pages/Index.tsx
@@ -10,9 +10,16 @@ import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import green from '@material-ui/core/colors/green';
import red from '@material-ui/core/colors/red';
import Typography from '@material-ui/core/Typography';
-import DoneIcon from '@material-ui/icons/Done';
+import CheckIcon from '@material-ui/icons/Check';
+import CloseIcon from '@material-ui/icons/Close';
+import ErrorOutlinedIcon from '@material-ui/icons/ErrorOutlined';
import { KeybaseUser } from '../../../common/KeybaseUser';
+import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, withMobileDialog } from '@material-ui/core';
+import Slide from '@material-ui/core/Slide';
+function Transition(props: any) {
+ return <Slide direction="up" {...props} />;
+}
interface ToolbarProps {
}
@@ -22,7 +29,9 @@ interface ToolbarState {
keybaseUsers: {[name: string]: KeybaseUser},
trustedUsers: string[],
barredUsers: string[],
- needsApproval: string[]
+ needsApproval: string[],
+ requiresApprovalDialogOpen: boolean,
+ requiresApprovalDialogUser: string,
}
const pillTheme = createMuiTheme({
@@ -32,7 +41,7 @@ const pillTheme = createMuiTheme({
},
});
-export class Index extends React.Component<ToolbarProps, ToolbarState> {
+export default class Index extends React.Component<ToolbarProps, ToolbarState> {
constructor(props: any) {
super(props);
this.state = {
@@ -40,7 +49,9 @@ export class Index extends React.Component<ToolbarProps, ToolbarState> {
keybaseUsers: {},
trustedUsers: [],
barredUsers: [],
- needsApproval: []
+ needsApproval: [],
+ requiresApprovalDialogOpen: false,
+ requiresApprovalDialogUser: ''
};
}
@@ -70,6 +81,7 @@ export class Index extends React.Component<ToolbarProps, ToolbarState> {
}
approve = async (user: string) => {
+ // TODO: get approval
const [ activeTab ] = await browser.tabs.query({ active: true });
browser.tabs.sendMessage(activeTab.id, new AllowUserEvent(this.state.domain, user))
.then(this.updateUsers.bind(this));
@@ -81,59 +93,91 @@ export class Index extends React.Component<ToolbarProps, ToolbarState> {
.then(this.updateUsers.bind(this));
}
+ requiresApprovalDialogClose = (approved: boolean, user: string) => {
+ if (approved == true) {
+ this.approve(user);
+ } else if (approved == false) {
+ this.deny(user);
+ }
+
+ this.setState({ requiresApprovalDialogOpen: false });
+ };
+
+ getClickActionForUser = (name: string) => () => {
+ // TODO: open profile
+ };
+
+ getButtonActionForUser = (name: string) => () => {
+ if (this.state.trustedUsers.includes(name)) {
+ this.deny(name);
+ } else if (this.state.barredUsers.includes(name)) {
+ // TODO: show dialog to confirm action
+ this.approve(name);
+ } else {
+ this.setState({
+ requiresApprovalDialogUser: name,
+ requiresApprovalDialogOpen: true
+ });
+ }
+ };
+
+ getButtonIconForUser = (name: string) => {
+ if (this.state.trustedUsers.includes(name)) {
+ return <CloseIcon />; // default button
+ } else if (this.state.barredUsers.includes(name)) {
+ return <CheckIcon />;
+ } else {
+ return <ErrorOutlinedIcon />
+ }
+ };
+
render() {
- return <div className="container">
+ return <div className="container" style={{minHeight: '11rem'}}>
<MuiThemeProvider theme={pillTheme}>
- <div>
- <Typography variant="h6" color="inherit">Trusted Users</Typography>
- { this.state.trustedUsers.map((u) => (
- <Chip
- avatar={
- <Avatar src={this.state.keybaseUsers[u].avatar}>
- {!this.state.keybaseUsers[u].avatar ? <FaceIcon /> : ''}
- </Avatar>
- }
- color="primary"
- label={u}
- onClick={() => alert('clicked')}
- onDelete={() => this.deny(u)} />
- )) }
- </div>
-
- <div>
- <Typography variant="h6" color="inherit">Barred Users</Typography>
- { this.state.barredUsers.map((u) => (
- <Chip
- avatar={
- <Avatar src={this.state.keybaseUsers[u].avatar}>
- {!this.state.keybaseUsers[u].avatar ? <FaceIcon /> : ''}
- </Avatar>
- }
- color="secondary"
- label={u}
- onClick={() => alert('clicked')}
- onDelete={() => this.approve(u)}
- deleteIcon={<DoneIcon />} />
- )) }
- </div>
- </MuiThemeProvider>
-
- <div>
- <Typography variant="h6" color="inherit">Needs Approval</Typography>
- { this.state.needsApproval.map((u) => (
+ { Object.entries(this.state.keybaseUsers).map(([name, u]) => (
<Chip
+ style={{margin: '1px'}}
avatar={
- <Avatar src={this.state.keybaseUsers[u].avatar}>
- {!this.state.keybaseUsers[u].avatar ? <FaceIcon /> : ''}
+ <Avatar src={u.avatar}>
+ {!u.avatar ? <FaceIcon /> : ''}
</Avatar>
}
- color="primary"
- label={u}
- onClick={() => alert('clicked')}
- onDelete={() => this.approve(u)}
- deleteIcon={<DoneIcon />} />
+ color={
+ this.state.barredUsers.includes(name)
+ ? 'secondary'
+ : (this.state.trustedUsers.includes(name)
+ ? 'primary'
+ : 'inherit')
+ }
+ label={name}
+ onClick={this.getClickActionForUser(name)}
+ onDelete={this.getButtonActionForUser(name)}
+ deleteIcon={this.getButtonIconForUser(name)} />
)) }
- </div>
+ </MuiThemeProvider>
+
+ <Dialog
+ fullScreen
+ open={this.state.requiresApprovalDialogOpen}
+ onClose={this.requiresApprovalDialogClose.bind(this, null, null)}
+ TransitionComponent={Transition}
+ aria-labelledby="alert-dialog-title"
+ aria-describedby="alert-dialog-description">
+ <DialogTitle id="alert-dialog-title">Allow scripts from {this.state.requiresApprovalDialogUser}?</DialogTitle>
+ <DialogContent>
+ <DialogContentText id="alert-dialog-description">
+ This will allow all scripts signed by this user to run on this website now and in the future.
+ </DialogContentText>
+ </DialogContent>
+ <DialogActions>
+ <Button onClick={this.requiresApprovalDialogClose.bind(this, true, this.state.requiresApprovalDialogUser)} color="primary">
+ Allow
+ </Button>
+ <Button onClick={this.requiresApprovalDialogClose.bind(this, false, this.state.requiresApprovalDialogUser)} color="secondary">
+ Deny
+ </Button>
+ </DialogActions>
+ </Dialog>
</div>;
}
-}
+} \ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index f1e83db..82bffc1 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,52 +1,78 @@
+const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
-module.exports = {
- entry: {
- content: './src/content/index.ts',
- popup: './src/popup/js/index.tsx',
- options: './src/options/js/index.tsx',
+module.exports.entry = {
+ content: './src/content/index.ts',
+ popup: './src/popup/js/index.tsx',
+ options: './src/options/js/index.tsx'
+};
+
+module.exports.devtool = 'inline-source-map';
+
+module.exports.module = {};
+module.exports.module.rules = [
+ {
+ test: /\.tsx?$/,
+ use: 'ts-loader',
+ exclude: /node_modules/
},
- devtool: 'inline-source-map',
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- use: 'ts-loader',
- exclude: /node_modules/
- },
- {
- test: /\.s[ac]ss$/,
- use: [
- { loader: 'style-loader' },
- { loader: 'css-loader' },
- { loader: 'sass-loader' }
- ]
- },
- {
- test: /\.css$/,
- use: [
- { loader: 'style-loader' },
- { loader: 'css-loader' }
- ]
- },
- {
- test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
- use: {
- loader: "url-loader",
- options: {
- limit: 50000,
- mimetype: "application/font-woff",
- name: "./fonts/[name].[ext]",
- }
- },
- }
+ {
+ test: /\.s[ac]ss$/,
+ use: [
+ { loader: 'style-loader' },
+ { loader: 'css-loader' },
+ { loader: 'sass-loader' }
]
},
- resolve: {
- extensions: [ '.tsx', '.ts', '.js', '.json' ]
+ {
+ test: /\.css$/,
+ use: [
+ { loader: 'style-loader' },
+ { loader: 'css-loader' }
+ ]
},
- output: {
- filename: '[name].js',
- path: path.resolve(__dirname, 'dist')
+ {
+ test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
+ use: {
+ loader: "url-loader",
+ options: {
+ limit: 50000,
+ mimetype: "application/font-woff",
+ name: "./fonts/[name].[ext]",
+ }
+ },
}
+];
+
+const baseHtmlConfig = {
+ title: 'KPJS',
+ inject: true,
+ template: require('html-webpack-template'),
+ appMountId: 'app',
+};
+
+module.exports.plugins = [];
+module.exports.plugins.push(
+ new HtmlWebpackPlugin({
+ ...baseHtmlConfig,
+ filename: 'popup.html',
+ chunks: ['popup'],
+ }),
+ new HtmlWebpackPlugin({
+ ...baseHtmlConfig,
+ filename: 'options.html',
+ chunks: ['options'],
+ })
+);
+
+module.exports.resolve = { extensions: [ '.tsx', '.ts', '.js', '.json' ] };
+
+module.exports.output = {
+ filename: '[name].js',
+ path: path.resolve(__dirname, 'dist')
+};
+module.exports.optimization = {
+ splitChunks: {
+ chunks: 'all',
+ },
};