Some modificatio and repair
This commit is contained in:
@@ -76,7 +76,7 @@ class EndpointsApi extends ApiController{
|
||||
|
||||
//Log Data Save
|
||||
if (isset($obj['logs'])){
|
||||
foreach ($deviceLogs as $log) {
|
||||
foreach ($obj['logs'] as $log) {
|
||||
$logManager = new LogManager('../logs/devices/'. date("Y-m-d").'.log');
|
||||
$logManager->setLevel(LOGLEVEL);
|
||||
$logManager->write("[Device Log Msg] Device_ID " . $deviceId . "->" . $log, LogRecordTypes::ERROR);
|
||||
|
@@ -31,18 +31,18 @@ class UpdatesApi {
|
||||
|
||||
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'], LogRecordTypes::INFO);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
// //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'], LogRecordTypes::INFO);
|
||||
// exit();
|
||||
// }
|
||||
// }
|
||||
|
||||
$macAddress = $_SERVER['HTTP_X_ESP8266_STA_MAC'];
|
||||
$localBinary = "../updater/" . str_replace(':', '', $macAddress) . ".bin";
|
||||
|
Reference in New Issue
Block a user