diff options
author | Johannes Zellner <johannes@cloudron.io> | 2018-09-13 21:16:44 +0200 |
---|---|---|
committer | Johannes Zellner <johannes@cloudron.io> | 2018-09-13 21:16:44 +0200 |
commit | 8a5c7d41224e6c232ea6095168f456d1887e112c (patch) | |
tree | 5be2308ffc0dd766f8aea5eeb8f07fdca6c019b7 | |
parent | e34255790fdb950092768e29145bac126f218610 (diff) | |
download | Surfer-8a5c7d41224e6c232ea6095168f456d1887e112c.tar.gz Surfer-8a5c7d41224e6c232ea6095168f456d1887e112c.tar.zst Surfer-8a5c7d41224e6c232ea6095168f456d1887e112c.zip |
disable folder listing by default and do not show welcome screen when enabled
-rwxr-xr-x | server.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ var configFile = path.resolve(__dirname, process.argv[3] || '.config.json'); | |||
29 | mkdirp.sync(rootFolder); | 29 | mkdirp.sync(rootFolder); |
30 | 30 | ||
31 | var config = { | 31 | var config = { |
32 | folderListingEnabled: true | 32 | folderListingEnabled: false |
33 | }; | 33 | }; |
34 | 34 | ||
35 | function getSettings(req, res, next) { | 35 | function getSettings(req, res, next) { |
@@ -87,7 +87,7 @@ app.use(router); | |||
87 | app.use('/_admin', express.static(__dirname + '/frontend')); | 87 | app.use('/_admin', express.static(__dirname + '/frontend')); |
88 | app.use('/', express.static(rootFolder)); | 88 | app.use('/', express.static(rootFolder)); |
89 | app.use('/', function welcomePage(req, res, next) { | 89 | app.use('/', function welcomePage(req, res, next) { |
90 | if (req.path !== '/') return next(); | 90 | if (config.folderListingEnabled || req.path !== '/') return next(); |
91 | res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); | 91 | res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); |
92 | }); | 92 | }); |
93 | app.use('/', function (req, res, next) { | 93 | app.use('/', function (req, res, next) { |