@@ -185,10 +185,16 @@ passport.deserializeUser(function(id, done) {
185185 }
186186
187187 function private ( req , res , next ) {
188- basicAuth ( {
189- users : { 'private' : 'nietzichtbaar' } ,
190- challenge : true
191- } ) ( req , res , next )
188+ if ( config . privateUser !== "none" ) {
189+ // console.log("PRIVATE_USER = " + config.privateUser + ".");
190+ basicAuth ( {
191+ users : { [ config . privateUser ] : config . privateCred } ,
192+ challenge : true
193+ } ) ( req , res , next )
194+ }
195+ else
196+ next ( )
197+
192198 }
193199
194200 function redirectUnnormalizeRepositoryName ( req , res , next ) {
@@ -201,10 +207,10 @@ passport.deserializeUser(function(id, done) {
201207 return ;
202208 }
203209 }
204- // if(req.params.repository.indexOf('*') !== -1)
205- // private(req,res,next)
206- // else
207- next ( )
210+ if ( config . privateRepoWithStar == "1" && req . params . repository . indexOf ( '*' ) !== - 1 )
211+ private ( req , res , next )
212+ else
213+ next ( )
208214 }
209215
210216 ////////////////////////////////////////////////////////////////
@@ -280,9 +286,10 @@ passport.deserializeUser(function(id, done) {
280286 res . sendFile ( 'views/install.sh' , { root : __dirname } ) ;
281287 } ) ;
282288
283- app . get ( '/' , function ( req , res ) {
284- res . render ( 'index' , { title : 'Home' , landingPage : true } ) ;
285- } ) ;
289+ app . get ( '/' ,
290+ page . defaultHomePage ,
291+ // res.render('index', { title: 'Home', landingPage: true });
292+ ) ;
286293
287294 ////////////////////////////////////////////////////////////////
288295 // TinCan (aka Experience) API
@@ -560,7 +567,7 @@ passport.deserializeUser(function(id, done) {
560567 page . renderWithETag ) ;
561568
562569 app . get ( '/repositories' ,
563- // private,
570+ private ,
564571 page . repositories )
565572
566573 app . post ( '/repositories' ,
@@ -572,29 +579,29 @@ passport.deserializeUser(function(id, done) {
572579 // private,
573580 redirectUnnormalizeRepositoryName ,
574581 page . mostRecentMetadata ,
575- xourses . index ) ;
576-
582+ xourses . index ) ;
577583
578584 if ( ! module . parent ) {
579585 server . listen ( app . get ( 'port' ) , function ( stream ) {
580586 console . log ( 'Express server listening on port ' + app . get ( 'port' ) ) ;
581- } ) ;
582- }
583-
584- // If nothing else matches, it is a 404
585- app . use ( function ( req , res , next ) {
586- res . status ( 404 ) . render ( '404' , { status : 404 , url : req . url } ) ;
587- } ) ;
587+ } ) ;
588+ }
588589
589- ////////////////////////////////////////////////////////////////
590- // Present errors to the user
591-
592- if ( 'development' == app . get ( 'env' ) ) {
593- // Middleware for development only, since this will dump a
590+ // If nothing else matches, it is a 404
591+ app . use ( function ( req , res , next ) {
592+ res . status ( 404 ) . render ( '404' , { status : 404 , url : req . url } ) ;
593+ } ) ;
594+
595+ ////////////////////////////////////////////////////////////////
596+ // Present errors to the user
597+
598+ if ( 'development' == app . get ( 'env' ) ) {
599+ // Middleware for development only, since this will dump a
594600 // stack trace
601+ console . log ( 'Running development version ' ) ;
595602 errorHandler . title = 'Ximera' ;
596- app . use ( errorHandler ( ) ) ;
597- }
603+ app . use ( errorHandler ( ) ) ;
604+ }
598605
599606 app . use ( function ( err , req , res , next ) {
600607 if ( res . headersSent ) {
0 commit comments