diff --git a/update.php b/update.php index e756b62..b483dca 100644 --- a/update.php +++ b/update.php @@ -26,6 +26,19 @@ $logManager = new LogManager(); header('Content-type: text/plain; charset=utf8', true); +//Filtrování IP adress +if (DEBUGMOD != 1) { + if (!in_array($_SERVER['REMOTE_ADDR'], HOMEIP)) { + echo json_encode(array( + 'state' => 'unsuccess', + 'errorMSG' => "Using API from your IP insnt alowed!", + )); + header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized"); + $logManager->write("[Updater] acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordType::WARNING); + exit(); + } +} + function sendFile($path) { header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK', true, 200);