From 21484dd6a2ea8dff75d9b8fba23e2c76920c05ea Mon Sep 17 00:00:00 2001 From: NoobishSVK Date: Thu, 7 Nov 2024 17:25:04 +0100 Subject: [PATCH] wizard bugfixes --- server/endpoints.js | 7 +++++-- web/js/setup.js | 2 +- web/js/wizard.js | 2 +- web/wizard.ejs | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/endpoints.js b/server/endpoints.js index 667a20c..d08eb19 100644 --- a/server/endpoints.js +++ b/server/endpoints.js @@ -222,12 +222,15 @@ router.post('/saveData', (req, res) => { }); router.get('/getData', (req, res) => { + if (configExists() === false) { + res.json(serverConfig); + } + if(req.session.isAdminAuthenticated) { // Check if the file exists fs.access(configPath, fs.constants.F_OK, (err) => { if (err) { - // File does not exist - res.status(404).send('Data not found'); + console.log(err); } else { // File exists, send it as the response res.sendFile(path.join(__dirname, '../' + configName + '.json')); diff --git a/web/js/setup.js b/web/js/setup.js index 892a899..3424a4b 100644 --- a/web/js/setup.js +++ b/web/js/setup.js @@ -187,5 +187,5 @@ async function loadConsoleLogs() { }); resolve(); }); - $("#console-output").scrollTop($("#console-output")[0].scrollHeight); + $("#console-output").length ? $("#console-output").scrollTop($("#console-output")[0].scrollHeight) : null; } diff --git a/web/js/wizard.js b/web/js/wizard.js index 15cb918..65fb492 100644 --- a/web/js/wizard.js +++ b/web/js/wizard.js @@ -1,7 +1,7 @@ $(document).ready(function() { $('.btn-prev').toggle($('.step:visible').index() !== 0); $('.btn-next').click(() => navigateStep(true)); - $('.btn-prev').click(() => navigateStep(false)); + $('.btn-prev').click(() => navigateStep(false)); }); function updateProgressBar(currentStep) { diff --git a/web/wizard.ejs b/web/wizard.ejs index 8eb61ba..4575663 100644 --- a/web/wizard.ejs +++ b/web/wizard.ejs @@ -211,7 +211,6 @@ -