@@ -4,11 +4,11 @@ const path = require('path');
4
4
const packageJson = require ( 'package-json' ) ;
5
5
const csrf = require ( 'csurf' ) ;
6
6
const Authentication = require ( './Authentication.js' ) ;
7
- var fs = require ( 'fs' ) ;
7
+ const fs = require ( 'fs' ) ;
8
8
9
9
const currentVersionFeatures = require ( '../package.json' ) . parseDashboardFeatures ;
10
10
11
- var newFeaturesInLatestVersion = [ ] ;
11
+ let newFeaturesInLatestVersion = [ ] ;
12
12
packageJson ( 'parse-dashboard' , { version : 'latest' , fullMetadata : true } )
13
13
. then ( latestPackage => {
14
14
if ( latestPackage . parseDashboardFeatures instanceof Array ) {
@@ -31,29 +31,29 @@ function getMount(mountPath) {
31
31
}
32
32
33
33
function checkIfIconsExistForApps ( apps , iconsFolder ) {
34
- for ( var i in apps ) {
35
- var currentApp = apps [ i ] ;
36
- var iconName = currentApp . iconName ;
37
- var path = iconsFolder + '/' + iconName ;
34
+ for ( const i in apps ) {
35
+ const currentApp = apps [ i ] ;
36
+ const iconName = currentApp . iconName ;
37
+ const path = iconsFolder + '/' + iconName ;
38
38
39
39
fs . stat ( path , function ( err ) {
40
40
if ( err ) {
41
- if ( 'ENOENT' == err . code ) { // file does not exist
42
- console . warn ( 'Icon with file name: ' + iconName + ' couldn\'t be found in icons folder!' ) ;
43
- } else {
44
- console . log (
45
- 'An error occurd while checking for icons, please check permission!' ) ;
46
- }
41
+ if ( 'ENOENT' == err . code ) { // file does not exist
42
+ console . warn ( 'Icon with file name: ' + iconName + ' couldn\'t be found in icons folder!' ) ;
43
+ } else {
44
+ console . log (
45
+ 'An error occurd while checking for icons, please check permission!' ) ;
46
+ }
47
47
} else {
48
- //every thing was ok so for example you can read it and send it to client
48
+ //every thing was ok so for example you can read it and send it to client
49
49
}
50
- } ) ;
50
+ } ) ;
51
51
}
52
52
}
53
53
54
54
module . exports = function ( config , options ) {
55
55
options = options || { } ;
56
- var app = express ( ) ;
56
+ const app = express ( ) ;
57
57
// Serve public files.
58
58
app . use ( express . static ( path . join ( __dirname , 'public' ) ) ) ;
59
59
@@ -72,7 +72,7 @@ module.exports = function(config, options) {
72
72
73
73
// CSRF error handler
74
74
app . use ( function ( err , req , res , next ) {
75
- if ( err . code !== 'EBADCSRFTOKEN' ) return next ( err )
75
+ if ( err . code !== 'EBADCSRFTOKEN' ) { return next ( err ) }
76
76
77
77
// handle CSRF token errors here
78
78
res . status ( 403 )
@@ -81,8 +81,8 @@ module.exports = function(config, options) {
81
81
82
82
// Serve the configuration.
83
83
app . get ( '/parse-dashboard-config.json' , function ( req , res ) {
84
- let apps = config . apps . map ( ( app ) => Object . assign ( { } , app ) ) ; // make a copy
85
- let response = {
84
+ const apps = config . apps . map ( ( app ) => Object . assign ( { } , app ) ) ; // make a copy
85
+ const response = {
86
86
apps : apps ,
87
87
newFeaturesInLatestVersion : newFeaturesInLatestVersion ,
88
88
} ;
@@ -159,7 +159,7 @@ module.exports = function(config, options) {
159
159
// running parse-dashboard from globally installed npm.
160
160
if ( config . iconsFolder ) {
161
161
try {
162
- var stat = fs . statSync ( config . iconsFolder ) ;
162
+ const stat = fs . statSync ( config . iconsFolder ) ;
163
163
if ( stat . isDirectory ( ) ) {
164
164
app . use ( '/appicons' , express . static ( config . iconsFolder ) ) ;
165
165
//Check also if the icons really exist
@@ -213,7 +213,7 @@ module.exports = function(config, options) {
213
213
}
214
214
return res . redirect ( `${ mountPath } login` ) ;
215
215
}
216
- if ( users && req . user && req . user . matchingUsername ) {
216
+ if ( users && req . user && req . user . matchingUsername ) {
217
217
res . append ( 'username' , req . user . matchingUsername ) ;
218
218
}
219
219
res . send ( `<!DOCTYPE html>
0 commit comments