fix Analyse
This commit is contained in:
@@ -7,7 +7,12 @@ const DB_FILE = process.env.DB_PATH || join(__dirname, 'data.json');
|
||||
|
||||
function loadDB() {
|
||||
if (existsSync(DB_FILE)) {
|
||||
return JSON.parse(readFileSync(DB_FILE, 'utf-8'));
|
||||
try {
|
||||
return JSON.parse(readFileSync(DB_FILE, 'utf-8'));
|
||||
} catch (e) {
|
||||
console.error('DB Datei korrupt, Backup erstellt:', e.message);
|
||||
try { writeFileSync(DB_FILE + '.bak', readFileSync(DB_FILE, 'utf-8')); } catch {}
|
||||
}
|
||||
}
|
||||
return { users: [], recipes: [], invite_tokens: [], _counters: { users: 0, recipes: 0, invite_tokens: 0 } };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user