mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
fix: Ensure ping can handle pings larger than 24 days by changing INT to BIGINT and FLOAT(8,2) to FLOAT(20,2) (#6668)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: louislam <1336778+louislam@users.noreply.github.com> Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
This commit is contained in:
co-authored by
louislam
CommanderStorm
parent
da693e01c7
commit
cde96900a2
@@ -52,6 +52,13 @@ router.all("/api/push/:pushToken", async (request, response) => {
|
||||
let statusString = request.query.status || "up";
|
||||
const statusFromParam = statusString === "up" ? UP : DOWN;
|
||||
|
||||
// Validate ping value - max 100 billion ms (~3.17 years)
|
||||
// Fits safely in both BIGINT and FLOAT(20,2)
|
||||
const MAX_PING_MS = 100000000000;
|
||||
if (ping !== null && (ping < 0 || ping > MAX_PING_MS)) {
|
||||
throw new Error(`Invalid ping value. Must be between 0 and ${MAX_PING_MS} ms.`);
|
||||
}
|
||||
|
||||
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [pushToken]);
|
||||
|
||||
if (!monitor) {
|
||||
|
||||
Reference in New Issue
Block a user