From 47ca65b3ce3353c332f8867e4a06c35d9dea7ab4 Mon Sep 17 00:00:00 2001 From: Anchel135 Date: Sun, 2 Feb 2025 12:04:04 +0200 Subject: [PATCH] Add validation for MAX_INFO_QUERIES configuration limit --- app/settings/Configurations.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/settings/Configurations.tsx b/app/settings/Configurations.tsx index 689937c2..a3404ed4 100644 --- a/app/settings/Configurations.tsx +++ b/app/settings/Configurations.tsx @@ -138,6 +138,17 @@ export default function Configurations() { return false; } + if (name === "MAX_INFO_QUERIES") { + if (Number(value) > 1000) { + toast({ + title: "Error", + description: "Value must be less than 1000", + variant: "destructive" + }); + return false; + } + } + const result = await securedFetch( `api/graph/?config=${prepareArg(name)}&value=${prepareArg(value)}`, { method: 'POST' }, @@ -145,7 +156,7 @@ export default function Configurations() { ); if (!result.ok) return false; - + const configToUpdate = configs.find(row => row.cells[0].value === name); const oldValue = configToUpdate?.cells[2].value;