Some Fixes
This commit is contained in:
		@@ -17,6 +17,7 @@ class UpdatesApi {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function default(){
 | 
					    public function default(){
 | 
				
			||||||
@@ -24,25 +25,25 @@ class UpdatesApi {
 | 
				
			|||||||
        $logManager->setLevel(LOGLEVEL);
 | 
					        $logManager->setLevel(LOGLEVEL);
 | 
				
			||||||
        $logManager->write("[Updater] Client Connected", LogRecordTypes::INFO);
 | 
					        $logManager->write("[Updater] Client Connected", LogRecordTypes::INFO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($this->validateHeader($_SERVER)){
 | 
					      //   if($this->validateHeader($_SERVER)){
 | 
				
			||||||
            header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
 | 
					      //       header($_SERVER["SERVER_PROTOCOL"]." 400 Bad Header");
 | 
				
			||||||
            die();
 | 
					      //       die();
 | 
				
			||||||
        }
 | 
					      //   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        header('Content-type: text/plain; charset=utf8', true);
 | 
					        header('Content-type: text/plain; charset=utf8', true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Filtrování IP adress
 | 
					        // //Filtrování IP adress
 | 
				
			||||||
        if (DEBUGMOD != 1) {
 | 
					        // if (DEBUGMOD != 1) {
 | 
				
			||||||
            if (!in_array($_SERVER['REMOTE_ADDR'], HOMEIP)) {
 | 
					        //     if (!in_array($_SERVER['REMOTE_ADDR'], HOMEIP)) {
 | 
				
			||||||
                echo json_encode(array(
 | 
					        //         echo json_encode(array(
 | 
				
			||||||
                    'state' => 'unsuccess',
 | 
					        //             'state' => 'unsuccess',
 | 
				
			||||||
                    'errorMSG' => "Using API from your IP insnt alowed!",
 | 
					        //             'errorMSG' => "Using API from your IP insnt alowed!",
 | 
				
			||||||
                ));
 | 
					        //         ));
 | 
				
			||||||
                header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
 | 
					        //         header($_SERVER["SERVER_PROTOCOL"]." 401 Unauthorized");
 | 
				
			||||||
                $logManager->write("[Updater] acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordTypes::INFO);
 | 
					        //         $logManager->write("[Updater] acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordTypes::INFO);
 | 
				
			||||||
                exit();
 | 
					        //         exit();
 | 
				
			||||||
            }
 | 
					        //     }
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $macAddress = $_SERVER['HTTP_X_ESP8266_STA_MAC'];
 | 
					        $macAddress = $_SERVER['HTTP_X_ESP8266_STA_MAC'];
 | 
				
			||||||
        $localBinary = "../updater/" . str_replace(':', '', $macAddress) . ".bin";
 | 
					        $localBinary = "../updater/" . str_replace(':', '', $macAddress) . ".bin";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user