From: Johannes Zellner Date: Thu, 17 May 2018 14:02:00 +0000 (+0200) Subject: Fixup the config file usage X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f43b3c162f5a0857d9fd56f4d8005763fcdca4cc;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git Fixup the config file usage --- diff --git a/frontend/js/app.js b/frontend/js/app.js index e9d469b..6303a89 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -35,7 +35,13 @@ function getProfile(accessToken, callback) { app.session.username = result.body.username; app.session.valid = true; - callback(); + superagent.get('/api/settings').query({ access_token: localStorage.accessToken }).end(function (error, result) { + if (error) console.error(error); + + app.folderListingEnabled = !!result.body.folderListingEnabled; + + callback(); + }); }); } @@ -339,12 +345,6 @@ getProfile(localStorage.accessToken, function (error) { if (error) return console.error(error); loadDirectory(window.location.hash.slice(1)); - - superagent.get('/api/settings').query({ access_token: localStorage.accessToken }).end(function (error, result) { - if (error) console.error(error); - - app.folderListingEnabled = !!result.body.folderListingEnabled; - }); }); $(window).on('hashchange', function () { diff --git a/server.js b/server.js index 4a8bfe5..60c1bdd 100755 --- a/server.js +++ b/server.js @@ -23,7 +23,7 @@ var express = require('express'), var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); -var configFile = path.resolve(__dirname, process.argv[3] || './config.json'); +var configFile = path.resolve(__dirname, process.argv[3] || '.config.json'); // Ensure the root folder exists mkdirp.sync(rootFolder);