|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
require_once __DIR__."/../util/dotenv.php"; |
|
|
|
|
|
|
|
|
|
header("X-Accel-Buffering: no"); |
|
|
|
|
header('Content-Type: text/event-stream'); |
|
|
|
|
header('Cache-Control: no-cache'); |
|
|
|
@ -20,14 +22,20 @@ function sendEvent(string $event, string $data): void{ |
|
|
|
|
require_once __DIR__."/../util/mysql_connect.php"; |
|
|
|
|
$conn = new MySQLConnection(); |
|
|
|
|
|
|
|
|
|
$update_limit = $_ENV["UPDATE_LIMIT_MINUTES"]; |
|
|
|
|
|
|
|
|
|
$result = $conn->query(" |
|
|
|
|
SELECT date |
|
|
|
|
FROM updates |
|
|
|
|
WHERE date > SUBTIME(NOW(), '00:10:00') |
|
|
|
|
WHERE date > SUBTIME(NOW(), '00:$update_limit:00') |
|
|
|
|
LIMIT 1 |
|
|
|
|
"); |
|
|
|
|
if ($result->num_rows > 0) { |
|
|
|
|
sendEvent("forbidden", $result->fetch_assoc()["date"]); |
|
|
|
|
$response = [ |
|
|
|
|
"limit" => $update_limit, |
|
|
|
|
"last" => $result->fetch_assoc()["date"] |
|
|
|
|
]; |
|
|
|
|
sendEvent("forbidden", json_encode($response)); |
|
|
|
|
die; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|