scripts, connectors, and webpack adjustments

This commit is contained in:
Kyle Spearrin 2018-06-05 09:01:40 -04:00
parent 8f14ced5af
commit 29d0803a5c
11 changed files with 75 additions and 48 deletions

12
src/connectors/duo.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Bitwarden Duo Connector</title>
</head>
<body></body>
</html>

View File

@ -1,4 +1,7 @@
!(function () {
require('../scripts/duo');
require('./duo.scss');
!(function () {
var frameElement = document.createElement('iframe');
frameElement.setAttribute('id', 'duo_iframe');
setFrameHeight();

17
src/connectors/duo.scss Normal file
View File

@ -0,0 +1,17 @@
html, body {
margin: 0;
padding: 0;
}
body {
background: #efeff4 url('../images/loading.svg') 0 0 no-repeat;
}
iframe {
display: block;
width: 100%;
height: 400px;
border: none;
margin: 0;
padding: 0;
}

11
src/connectors/u2f.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Bitwarden U2F Connector</title>
</head>
<body></body>
</html>

View File

@ -1,4 +1,6 @@
document.addEventListener('DOMContentLoaded', function (event) {
require('../scripts/u2f');
document.addEventListener('DOMContentLoaded', function (event) {
init();
});

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Duo Two-step Login</title>
<style>
html, body {
margin: 0;
padding: 0;
}
body {
background: #efeff4 url('images/loading.svg') 0 0 no-repeat;
}
iframe {
display: block;
width: 100%;
height: 400px;
border: none;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script src="js/duo.js"></script>
<script src="js/duo-connector.js"></script>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>U2F Connector</title>
</head>
<body>
<script src="js/u2f-api.js"></script>
<script src="js/u2f-connector.js"></script>
</body>
</html>

View File

@ -35,6 +35,18 @@ const moduleRules = [
test: /\.(html)$/,
loader: 'html-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
exclude: /.*(fontawesome-webfont|glyphicons-halflings-regular)\.svg/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'images/',
publicPath: './images/',
},
}],
},
{
test: /\.scss$/,
use: extractCss.extract({
@ -61,7 +73,17 @@ const plugins = [
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
chunks: ['vendor', 'main'],
chunks: ['app/vendor', 'app/main'],
}),
new HtmlWebpackPlugin({
template: './src/connectors/duo.html',
filename: 'duo-connector.html',
chunks: ['connectors/duo'],
}),
new HtmlWebpackPlugin({
template: './src/connectors/u2f.html',
filename: 'u2f-connector.html',
chunks: ['connectors/u2f'],
}),
new CopyWebpackPlugin([
{ from: './src/manifest.json' },
@ -73,7 +95,7 @@ const plugins = [
]),
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map',
include: ['main.js'],
include: ['app/main.js'],
}),
extractCss,
new webpack.DefinePlugin({
@ -113,7 +135,9 @@ const config = {
mode: ENV,
serve: serve,
entry: {
'main': './src/app/main.ts',
'app/main': './src/app/main.ts',
'connectors/u2f': './src/connectors/u2f.js',
'connectors/duo': './src/connectors/duo.js',
},
resolve: {
extensions: ['.ts', '.js'],
@ -132,7 +156,7 @@ const config = {
cacheGroups: {
vendor: {
test: isVendorModule,
name: 'vendor',
name: 'app/vendor',
chunks: 'initial',
enforce: true,
}