From 06924cc5d4c8141f18cd1bf75e10a37c6f99c5cc Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 29 Dec 2021 22:54:57 +0100 Subject: [PATCH] brought back time traveler check with rounded timestamps --- backend/api/controllers/result.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/api/controllers/result.js b/backend/api/controllers/result.js index be1a29972..8bb4f82ae 100644 --- a/backend/api/controllers/result.js +++ b/backend/api/controllers/result.js @@ -111,12 +111,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(result.timestamp / 1000) * 1000; + if (result.timestamp > Math.round(Date.now() / 1000) * 1000) { + return res.status(400).json({ message: "Time traveler detected" }); + } + let timestampres = await ResultDAO.getResultByTimestamp( uid, result.timestamp