diff --git a/src/connectors/duo.html b/src/connectors/duo.html new file mode 100644 index 00000000..31a48887 --- /dev/null +++ b/src/connectors/duo.html @@ -0,0 +1,12 @@ + + + + + + + Bitwarden Duo Connector + + + + + diff --git a/src/js/duo-connector.js b/src/connectors/duo.js similarity index 93% rename from src/js/duo-connector.js rename to src/connectors/duo.js index c4f1d601..2af5a0f8 100644 --- a/src/js/duo-connector.js +++ b/src/connectors/duo.js @@ -1,4 +1,7 @@ -!(function () { +require('../scripts/duo'); +require('./duo.scss'); + +!(function () { var frameElement = document.createElement('iframe'); frameElement.setAttribute('id', 'duo_iframe'); setFrameHeight(); diff --git a/src/connectors/duo.scss b/src/connectors/duo.scss new file mode 100644 index 00000000..8f5c0373 --- /dev/null +++ b/src/connectors/duo.scss @@ -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; +} diff --git a/src/connectors/u2f.html b/src/connectors/u2f.html new file mode 100644 index 00000000..8e3785b7 --- /dev/null +++ b/src/connectors/u2f.html @@ -0,0 +1,11 @@ + + + + + + Bitwarden U2F Connector + + + + + diff --git a/src/js/u2f-connector.js b/src/connectors/u2f.js similarity index 96% rename from src/js/u2f-connector.js rename to src/connectors/u2f.js index c09b33fd..af51eaf6 100644 --- a/src/js/u2f-connector.js +++ b/src/connectors/u2f.js @@ -1,4 +1,6 @@ -document.addEventListener('DOMContentLoaded', function (event) { +require('../scripts/u2f'); + +document.addEventListener('DOMContentLoaded', function (event) { init(); }); diff --git a/src/duo-connector.html b/src/duo-connector.html deleted file mode 100644 index 7de0ae63..00000000 --- a/src/duo-connector.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Duo Two-step Login - - - - - - - diff --git a/src/js/duo.js b/src/scripts/duo.js similarity index 100% rename from src/js/duo.js rename to src/scripts/duo.js diff --git a/src/js/u2f-api.js b/src/scripts/u2f.js similarity index 100% rename from src/js/u2f-api.js rename to src/scripts/u2f.js diff --git a/src/js/webcrypto-shim.js b/src/scripts/webcrypto-shim.js similarity index 100% rename from src/js/webcrypto-shim.js rename to src/scripts/webcrypto-shim.js diff --git a/src/u2f-connector.html b/src/u2f-connector.html deleted file mode 100644 index 4d4f1f69..00000000 --- a/src/u2f-connector.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - U2F Connector - - - - - - diff --git a/webpack.config.js b/webpack.config.js index 259076c8..aca62d81 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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, }