add json backup fallback

This commit is contained in:
2026-04-22 12:11:05 +02:00
parent 92444ff38c
commit 535742787d
3 changed files with 2442 additions and 3 deletions

View File

@@ -30,15 +30,20 @@ app.locals.path = {
//#endregion
//#region Server configuration
//#region Nesessary json files
const jsonFiles = ['configuration.json', 'stylesheet.json'];
for (var i = 0; i < jsonFiles.length; i++) {
if(!fs.existsSync(`${app.locals.path.source}/models/${jsonFiles[i]}`)) {
fs.copyFileSync(`${app.locals.path.source}/backups/${jsonFiles[i]}.temp`, `${app.locals.path.source}/models/${jsonFiles[i]}`);
}
}
app.locals.stylesheet = JSON.parse(fs.readFileSync(`${app.locals.path.source}/models/stylesheet.json`, 'utf-8'));
app.locals.configuration = JSON.parse(fs.readFileSync(`${app.locals.path.source}/models/configuration.json`, 'utf-8'));
app.locals.package = JSON.parse(fs.readFileSync(`${app.locals.path.root}/package.json`, 'utf-8'));
app.locals.startMenuItems = [ ];
(async () => {
// const server = https.createServer({
// key: fs.readFileSync(`${app.locals.path.source}/secure/${app.locals.configuration.certificate.key}`),