mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
using serverside date when saving results
This commit is contained in:
parent
03d850b4aa
commit
652a1def66
1 changed files with 6 additions and 4 deletions
|
@ -100,6 +100,12 @@ class ResultController {
|
|||
return res.status(400).json({ message: "Incorrect result hash" });
|
||||
}
|
||||
|
||||
if (result.timestamp > Date.now()) {
|
||||
return res.status(400).json({ message: "Time traveler detected" });
|
||||
}
|
||||
|
||||
result.timestamp = Math.round(Date.now() / 1000) * 1000;
|
||||
|
||||
let timestampres = await ResultDAO.getResultByTimestamp(
|
||||
uid,
|
||||
result.timestamp
|
||||
|
@ -108,10 +114,6 @@ class ResultController {
|
|||
return res.status(400).json({ message: "Duplicate result" });
|
||||
}
|
||||
|
||||
if (result.timestamp > Date.now()) {
|
||||
return res.status(400).json({ message: "Time traveler detected" });
|
||||
}
|
||||
|
||||
try {
|
||||
result.keySpacingStats = {
|
||||
average:
|
||||
|
|
Loading…
Reference in a new issue