diff --git a/app.js b/app.js index d1bef84..b0c0ba9 100644 --- a/app.js +++ b/app.js @@ -12,7 +12,6 @@ const onExit = () => { cp.execSync("pause > nul", { stdio: "inherit" }) }; -// TODO: use kotlin rewrite it (async () => { try { process.once("SIGHUP", () => { @@ -77,11 +76,13 @@ const onExit = () => { } } let monitor; + let stopped = false const createMonitor = () => { monitor = setInterval(async () => { - if (login && lastRecvTimestamp + 2 < parseInt(Date.now() / 1000)) { + if (login && lastRecvTimestamp + 2 < parseInt(Date.now() / 1000) && !stopped) { + stopped = true unexpectedExit = false - server.close() + server.close(() => {}) hServer.close() gameProcess.kill() clearInterval(monitor) diff --git a/export.js b/export.js index 2f50a43..277f5b4 100644 --- a/export.js +++ b/export.js @@ -124,6 +124,10 @@ const exportData = async proto => { case "2": await exportToSeelie(proto) break + case "raw": + fs.writeFileSync(`./export-${Date.now()}-raw.json`, JSON.stringify(proto,null,2)) + console.log("OK") + break default: await exportToCsv(proto) }