1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

wizard bugfixes

This commit is contained in:
NoobishSVK
2024-11-07 17:25:04 +01:00
parent 73e7a7bf19
commit 21484dd6a2
4 changed files with 7 additions and 5 deletions

View File

@@ -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'));