@@ -4,11 +4,11 @@ const path = require('path');
44const packageJson = require ( 'package-json' ) ;
55const csrf = require ( 'csurf' ) ;
66const Authentication = require ( './Authentication.js' ) ;
7- var fs = require ( 'fs' ) ;
7+ const fs = require ( 'fs' ) ;
88
99const currentVersionFeatures = require ( '../package.json' ) . parseDashboardFeatures ;
1010
11- var newFeaturesInLatestVersion = [ ] ;
11+ let newFeaturesInLatestVersion = [ ] ;
1212packageJson ( 'parse-dashboard' , { version : 'latest' , fullMetadata : true } )
1313 . then ( latestPackage => {
1414 if ( latestPackage . parseDashboardFeatures instanceof Array ) {
@@ -31,29 +31,29 @@ function getMount(mountPath) {
3131}
3232
3333function 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 ;
3838
3939 fs . stat ( path , function ( err ) {
4040 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+ }
4747 } 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
4949 }
50- } ) ;
50+ } ) ;
5151 }
5252}
5353
5454module . exports = function ( config , options ) {
5555 options = options || { } ;
56- var app = express ( ) ;
56+ const app = express ( ) ;
5757 // Serve public files.
5858 app . use ( express . static ( path . join ( __dirname , 'public' ) ) ) ;
5959
@@ -72,7 +72,7 @@ module.exports = function(config, options) {
7272
7373 // CSRF error handler
7474 app . use ( function ( err , req , res , next ) {
75- if ( err . code !== 'EBADCSRFTOKEN' ) return next ( err )
75+ if ( err . code !== 'EBADCSRFTOKEN' ) { return next ( err ) }
7676
7777 // handle CSRF token errors here
7878 res . status ( 403 )
@@ -81,8 +81,8 @@ module.exports = function(config, options) {
8181
8282 // Serve the configuration.
8383 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 = {
8686 apps : apps ,
8787 newFeaturesInLatestVersion : newFeaturesInLatestVersion ,
8888 } ;
@@ -159,7 +159,7 @@ module.exports = function(config, options) {
159159 // running parse-dashboard from globally installed npm.
160160 if ( config . iconsFolder ) {
161161 try {
162- var stat = fs . statSync ( config . iconsFolder ) ;
162+ const stat = fs . statSync ( config . iconsFolder ) ;
163163 if ( stat . isDirectory ( ) ) {
164164 app . use ( '/appicons' , express . static ( config . iconsFolder ) ) ;
165165 //Check also if the icons really exist
@@ -213,7 +213,7 @@ module.exports = function(config, options) {
213213 }
214214 return res . redirect ( `${ mountPath } login` ) ;
215215 }
216- if ( users && req . user && req . user . matchingUsername ) {
216+ if ( users && req . user && req . user . matchingUsername ) {
217217 res . append ( 'username' , req . user . matchingUsername ) ;
218218 }
219219 res . send ( `<!DOCTYPE html>
0 commit comments