Compare commits

..

No commits in common. "af207d8a01a6dc5166811d4d7768b75a261ba15b" and "127def18b337a5b12986a9414426e3d5d3ca0965" have entirely different histories.

1 changed files with 5 additions and 5 deletions

View File

@ -174,24 +174,24 @@ function precheck(Message $message): bool
} }
} }
if (!isset($payload["valid_seconds"])) { if(!isset($payload["valid_seconds"])){
$payload["valid_seconds"] = 60; $payload["valid_seconds"] = 60;
} }
if (!is_numeric($payload["valid_seconds"])) { if(!is_numeric($payload["valid_seconds"])){
error("valid_seconds must be a number"); error("valid_seconds must be a number");
return false; return false;
} }
if ($payload["valid_seconds"] < 1) { if($payload["valid_seconds"] < 1){
error("valid_seconds must be at least 1"); error("valid_seconds must be at least 1");
return false; return false;
} }
if ($payload["valid_seconds"] > 60 * 60 * 48) { if($payload["valid_seconds"] >60*60*48){
error("valid_seconds must be at most 48 hours"); error("valid_seconds must be at most 48 hours");
return false; return false;
} }
foreach (array_keys($payload) as $key) { foreach (array_keys($payload) as $key) {
if (!in_array($key, ["name", "value", "labels", "valid_seconds"])) { if (!in_array($key, ["name", "value", "labels","valid_until"])) {
error("Unknown key: $key"); error("Unknown key: $key");
return false; return false;
} }