Skip to content

Commit 04c370d

Browse files
Fix express response pages
1 parent 9ad868c commit 04c370d

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

Parse-Dashboard/app.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ module.exports = function(config, options) {
6060
// wait for app to mount in order to get mountpath
6161
app.on('mount', function() {
6262
const mountPath = getMount(app.mountpath);
63+
let dashboardUrl = '';
64+
let loginUrl = '';
65+
66+
// Reads files from public/bundles folder, looking for dashboard.<hash>.js and login.<hash>.js
67+
fs.readdir(path.join(__dirname, 'public', 'bundles'), function(err, items) {
68+
dashboardUrl = items.filter(file => file.indexOf('dashboard.') === 0)[0] || 'dashboard.bundle.js';
69+
loginUrl = items.filter(file => file.indexOf('login.') === 0)[0] || 'login.bundle.js';
70+
});
71+
6372
const users = config.users;
6473
const useEncryptedPasswords = config.useEncryptedPasswords ? true : false;
6574
const authInstance = new Authentication(users, useEncryptedPasswords, mountPath);
@@ -180,7 +189,6 @@ module.exports = function(config, options) {
180189
res.send(`<!DOCTYPE html>
181190
<head>
182191
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
183-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
184192
<base href="${mountPath}"/>
185193
<script>
186194
PARSE_DASHBOARD_PATH = "${mountPath}";
@@ -192,7 +200,7 @@ module.exports = function(config, options) {
192200
<div id="login_mount"></div>
193201
${errors}
194202
<script id="csrf" type="application/json">"${req.csrfToken()}"</script>
195-
<script src="${mountPath}bundles/login.bundle.js"></script>
203+
<script src="${mountPath}bundles/${loginUrl}"></script>
196204
</body>
197205
</html>
198206
`);
@@ -206,7 +214,6 @@ module.exports = function(config, options) {
206214
res.send(`<!DOCTYPE html>
207215
<head>
208216
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
209-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
210217
<base href="${mountPath}"/>
211218
<script>
212219
PARSE_DASHBOARD_PATH = "${mountPath}";
@@ -216,7 +223,7 @@ module.exports = function(config, options) {
216223
<title>Parse Dashboard</title>
217224
<body>
218225
<div id="browser_mount"></div>
219-
<script src="${mountPath}bundles/dashboard.bundle.js"></script>
226+
<script src="${mountPath}bundles/${dashboardUrl}"></script>
220227
<script src="https://static.back4app.com/back4app-navigation.bundle.js"></script>
221228
</body>
222229
</html>

Parse-Dashboard/index.template.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
<base href="/"/>
55
<script>
66
PARSE_DASHBOARD_PATH = "/";
7-
console.log('hello')
87
</script>
98
<script src="https://static.back4app.com/back4app-navigation.bundle.js"></script>
10-
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">-->
119
</head>
1210
<html>
1311
<title>Parse Dashboard</title>

webpack/build.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@
66
* the root directory of this source tree.
77
*/
88
var configuration = require('./base.config.js');
9+
var HtmlWebpackPlugin = require('html-webpack-plugin');
10+
var path = require('path');
911

1012
configuration.entry = {
1113
dashboard: './dashboard/index.js',
1214
login: './login/index.js'
1315
};
1416
configuration.output.path = require('path').resolve('./Parse-Dashboard/public/bundles');
17+
configuration.output.filename = "[name].[chunkhash].js";
18+
19+
configuration.plugins.push(
20+
new HtmlWebpackPlugin({
21+
template: '../Parse-Dashboard/index.template.html',
22+
filename: path.resolve('./Parse-Dashboard/public/index.html')
23+
})
24+
);
1525

1626
module.exports = configuration;

webpack/publish.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ configuration.plugins.push(
3333
new webpack.optimize.OccurrenceOrderPlugin(),
3434
new HtmlWebpackPlugin({
3535
template: '../Parse-Dashboard/index.template.html',
36-
filename: path.resolve('./Parse-Dashboard/index.html')
36+
filename: path.resolve('./Parse-Dashboard/public/index.html')
3737
}),
3838
function() {
3939
this.plugin('done', function(stats) {

0 commit comments

Comments
 (0)