diff --git a/lib/browserid/views.js b/lib/browserid/views.js index 412609c48bcb3ee5314cf3ed8f4023d68c9687fc..d4dbd13e84414386eff4d5dc20acfaddce70431e 100644 --- a/lib/browserid/views.js +++ b/lib/browserid/views.js @@ -114,4 +114,18 @@ exports.setup = function(app) { app.get("/pk", function(req, res) { res.json(publicKey.toSimpleObject()); }); + + // vep bundle of JavaScript + try { + const vepBundleFilePath = path.join(__dirname, "..", "..", "node_modules", "jwcrypto", "vepbundle.js"); + var vepBundleFile = fs.readFileSync(vepBundleFilePath); + } catch(e) { + logger.error("can't read vepbundle file (" + vepBundleFilePath +"): " + e); + } + + app.get("/vepbundle", function(req, res) { + res.writeHead(200, {'Content-Type': 'text/javascript'}); + res.write(vepBundleFile); + res.end(); + }); }; diff --git a/resources/static/communication_iframe/iframe.js b/resources/static/communication_iframe/iframe.js index 30e37ac1d48934ba3e2e37eddbb4abad42922552..da4e50dfba37a28ed08b6d09d99b658ee0e148c1 100644 --- a/resources/static/communication_iframe/iframe.js +++ b/resources/static/communication_iframe/iframe.js @@ -44,7 +44,6 @@ steal .then('../lib/jschannel', '../lib/base64', '../lib/underscore-min', - '../lib/vepbundle', '../dialog/resources/channel', '../shared/browserid', '../shared/storage', diff --git a/resources/static/dialog/dialog.js b/resources/static/dialog/dialog.js index 6bbaaeb037d49d4b75b44807dd62503474fec028..c84c1a7457661b209bbad3210b7c0de09ac49cc4 100644 --- a/resources/static/dialog/dialog.js +++ b/resources/static/dialog/dialog.js @@ -49,7 +49,6 @@ steal '../lib/jschannel', '../lib/base64', '../lib/underscore-min', - '../lib/vepbundle', '../lib/ejs', '../shared/browserid', '../lib/dom-jquery', diff --git a/resources/static/lib/vepbundle.js b/resources/static/lib/vepbundle.js deleted file mode 120000 index 99cb32376ee635d267c21a3ede971c60fff554f1..0000000000000000000000000000000000000000 --- a/resources/static/lib/vepbundle.js +++ /dev/null @@ -1 +0,0 @@ -../../../node_modules/jwcrypto/vepbundle.js \ No newline at end of file diff --git a/resources/static/test/qunit.html b/resources/static/test/qunit.html index 1af7410adb136f66065df84878b87a2511c6eef5..5ca813c687215df09e5eaf8ba1372aa2805cd5ef 100644 --- a/resources/static/test/qunit.html +++ b/resources/static/test/qunit.html @@ -2,6 +2,7 @@ <head> <link rel="stylesheet" type="text/css" href="/funcunit/qunit/qunit.css" /> <title>BrowserID QUnit Test</title> + <script type='text/javascript' src='/vepbundle'></script> <script type='text/javascript' src='/steal/steal.js?/test/qunit'></script> </head> <body> diff --git a/resources/views/communication_iframe.ejs b/resources/views/communication_iframe.ejs index 1dc71765a05deec4ee12ce2c12e12e5dfc13cc80..b7fb8d007befcb2d2438a9a2ff788b5fd163d819 100644 --- a/resources/views/communication_iframe.ejs +++ b/resources/views/communication_iframe.ejs @@ -1,3 +1,4 @@ <head><title>non-interactive iframe</title> + <script type="text/javascript" src="/vepbundle"></script> <script type="text/javascript" src="steal/steal<%= production ? '.production' : '' %>.js?communication_iframe/iframe.js"></script> </head><body></body> diff --git a/resources/views/dialog_layout.ejs b/resources/views/dialog_layout.ejs index b638047c844917a6afa35f18d310c98b8f02f721..3d515360ccf4cbc8d71b9f5d5cbc11a4ea7eaa61 100644 --- a/resources/views/dialog_layout.ejs +++ b/resources/views/dialog_layout.ejs @@ -45,6 +45,7 @@ </div> <% if (useJavascript !== false) { %> + <script type="text/javascript" src="/vepbundle"></script> <script type="text/javascript" src="steal/steal<%= production ? '.production' : '' %>.js?dialog"></script> <% } %> </body> diff --git a/resources/views/layout.ejs b/resources/views/layout.ejs index 549618dd91e8e67039a4b150527764c8dbeeb71b..8f942a62161bf99e744ac94970ab0563b2461ca5 100644 --- a/resources/views/layout.ejs +++ b/resources/views/layout.ejs @@ -7,6 +7,7 @@ <script src="/js/html5shim.js"></script> <![endif]--> <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic' rel='stylesheet' type='text/css'> + <script src="/vepbundle" type="text/javascript"></script> <% if (production) { %> <link rel="stylesheet" type="text/css" href="/css/browserid.min.css"> <script src="/pages/lib.min.js" type="text/javascript"></script> @@ -14,7 +15,6 @@ <link rel="stylesheet" href="/css/style.css" type="text/css" media="screen"> <link rel="stylesheet" href="/css/m.css" type="text/css" media="screen"> - <script src="/lib/vepbundle.js" type="text/javascript"></script> <script src="/lib/jquery-1.6.2.min.js" type="text/javascript"></script> <script src="/lib/json2.js" type="text/javascript"></script> <script src="/lib/underscore-min.js" type="text/javascript"></script>