Skip to content

Commit

Permalink
refactor: report
Browse files Browse the repository at this point in the history
  • Loading branch information
whes1015 committed Jul 25, 2023
1 parent 177cc57 commit abe6cd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/index/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ async function fetch_report() {
_report_data = storage.getItem("report_data");
if (typeof _report_data != "object") _report_data = [];
const list = {};
for (let i = 0; i < 50; i++) {
for (let i = 0; i < _report_data.length; i++) {
if (i > 49) break;
const md5 = crypto.createHash("md5");
list[_report_data[i].identifier] = md5.update(JSON.stringify(_report_data[i])).digest("hex");
}
Expand Down Expand Up @@ -128,7 +129,9 @@ async function fetch_report() {
_report_data[_i + 1] = _report_data[_i];
_report_data[_i] = temp;
}
_report_data = _report_data.slice(0, 500);
storage.setItem("report_data", _report_data);
fs.writeFile(path.join(app.getPath("userData"), "report.db"), JSON.stringify(_report_data), () => void 0);
report_data = _report_data;
c(true);
})
Expand Down

0 comments on commit abe6cd4

Please sign in to comment.