1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-09 20:52:39 +01:00

load cryptofill.js async

This commit is contained in:
Danny Coates 2018-11-26 10:36:49 -08:00
parent 5845fa5c05
commit 87ac8b241b
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
9 changed files with 14627 additions and 48 deletions

View File

@ -4,3 +4,4 @@ firefox
coverage
app/locale.js
app/capabilities.js
app/cryptofill.js

View File

@ -1,5 +1,5 @@
dist
android/app/src/main/assets
android/app/build
assets/*.js
app/cryptofill.js
coverage

View File

@ -35,9 +35,22 @@ async function checkCrypto() {
false,
['deriveKey']
);
await crypto.subtle.generateKey(
{
name: 'ECDH',
namedCurve: 'P-256'
},
true,
['deriveBits']
);
return true;
} catch (err) {
return false;
try {
await import('./cryptofill');
return true;
} catch (e) {
return false;
}
}
}
@ -62,7 +75,7 @@ async function polyfillStreams() {
}
export default async function capabilities() {
const crypto = await checkCrypto();
let crypto = await checkCrypto();
const nativeStreams = checkStreams();
let polyStreams = false;
if (!nativeStreams) {
@ -72,7 +85,7 @@ export default async function capabilities() {
try {
account = account && !!localStorage;
} catch (e) {
// nevermind
account = false;
}
return {

14596
app/cryptofill.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

9
package-lock.json generated
View File

@ -17062,6 +17062,15 @@
}
}
},
"script-loader": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/script-loader/-/script-loader-0.7.2.tgz",
"integrity": "sha512-UMNLEvgOAQuzK8ji8qIscM3GIrRCWN6MmMXGD4SD5l6cSycgGsCo0tX5xRnfQcoghqct0tjHjcykgI1PyBE2aA==",
"dev": true,
"requires": {
"raw-loader": "~0.5.1"
}
},
"scroll-to-anchor": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/scroll-to-anchor/-/scroll-to-anchor-1.1.0.tgz",

View File

@ -109,6 +109,7 @@
"raw-loader": "^0.5.1",
"redis-mock": "^0.39.0",
"rimraf": "^2.6.2",
"script-loader": "^0.7.2",
"sinon": "^7.1.1",
"string-hash": "^1.1.3",
"stylelint": "^9.8.0",

View File

@ -36,7 +36,6 @@ module.exports = function(app) {
locale: 'en-US'
})
}
<script src="${assets.get('cryptofill.js')}"></script>
<script src="${assets.get('tests.js')}"></script>
</head>
<body>

View File

@ -36,17 +36,6 @@ const serviceWorker = {
devtool: 'source-map',
module: {
rules: [
{
include: [require.resolve('./assets/cryptofill')],
use: [
{
loader: 'file-loader',
options: {
name: '[name].[hash:8].[ext]'
}
}
]
},
{
test: /\.(png|jpg)$/,
loader: 'file-loader',
@ -102,15 +91,8 @@ const web = {
test: /\.js$/,
oneOf: [
{
include: [require.resolve('./assets/cryptofill')],
use: [
{
loader: 'file-loader',
options: {
name: '[name].[hash:8].[ext]'
}
}
]
include: [require.resolve('./app/cryptofill')],
use: ['script-loader']
},
{
loader: 'babel-loader',
@ -120,6 +102,7 @@ const web = {
// some dependencies need to get re-babeled because we
// have different targets than their default configs
path.resolve(__dirname, 'node_modules/testpilot-ga/src'),
path.resolve(__dirname, 'node_modules/fluent'),
path.resolve(__dirname, 'node_modules/fluent-intl-polyfill'),
path.resolve(__dirname, 'node_modules/intl-pluralrules')
],