add fireworks when game finished

This commit is contained in:
Zutatensuppe 2020-12-09 01:27:47 +01:00
parent f017499cbf
commit 1ac9be4307
3 changed files with 251 additions and 1 deletions

View file

@ -23,7 +23,12 @@ function loadAllGames() {
}
const file = `${DATA_DIR}/${f}`
const contents = fs.readFileSync(file, 'utf-8')
const game = JSON.parse(contents)
let game
try {
game = JSON.parse(contents)
} catch {
console.log(`[ERR] unable to load game from file ${f}`);
}
if (typeof game.puzzle.data.started === 'undefined') {
game.puzzle.data.started = Math.round(fs.statSync(file).ctimeMs)
}