BACKGROUND SINC
This commit is contained in:
parent
f0e82de775
commit
0b8ad755a0
4
api.php
4
api.php
@ -38,8 +38,7 @@ Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
||||
//Read API data
|
||||
$json = file_get_contents('php://input');
|
||||
$obj = json_decode($json, true);
|
||||
$logManager->write("[API] Rest API request body \n" . $json, LogRecordType::INFO);
|
||||
//$logManager->write("[API] Rest API request body -> decodet to json \n" . var_dump($obj), LogRecordType::INFO);
|
||||
$logManager->write("[API] Rest API request body -> decodet to json \n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordType::INFO);
|
||||
|
||||
//zabespecit proti Ddosu
|
||||
if (isset($obj['user']) && $obj['user'] != ''){
|
||||
@ -75,7 +74,6 @@ try {
|
||||
$fallbackManager = new FallbackManager(RANGES);
|
||||
$fallbackManager->check();
|
||||
LogKeeper::purge(LOGTIMOUT);
|
||||
die();
|
||||
} catch (\Exception $e) {
|
||||
$logManager->write("[Automation] Something happen during automation execution", LogRecordType::ERROR);
|
||||
}
|
||||
|
@ -239,43 +239,46 @@ $( '[name="room"]' ).change(function (e) {
|
||||
});
|
||||
}
|
||||
});
|
||||
/*
|
||||
|
||||
|
||||
var windowLoc = $(location).attr('pathname');
|
||||
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
|
||||
console.log();
|
||||
if (windowLoc == "/") {
|
||||
var autoUpdate = setInterval(function(){
|
||||
if (pending == false) {
|
||||
pending = true;
|
||||
$.ajax({
|
||||
url: 'ajax',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"action": 'getState'
|
||||
},
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
const device = data[key];
|
||||
$('[data-sub-device-id="'+key+'"]')
|
||||
.find('.device-button-value')
|
||||
.text(device['value'])
|
||||
.attr('title',device['time'])
|
||||
var autoUpdate = setInterval(function(){
|
||||
if (pending == false) {
|
||||
pending = true;
|
||||
$.ajax({
|
||||
url: 'ajax',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"action": 'getState'
|
||||
},
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
const device = data[key];
|
||||
$('[data-sub-device-id="'+key+'"]')
|
||||
.find('.device-button-value')
|
||||
.text(device['value'])
|
||||
.attr('title',device['time'])
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
console.log("ERROR ajaxChart():", request, error);
|
||||
},
|
||||
complete: function (){
|
||||
pending = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},4000);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
console.log("ERROR ajaxChart():", request, error);
|
||||
},
|
||||
complete: function (){
|
||||
pending = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},4000);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
//Graphs
|
||||
|
@ -145,6 +145,12 @@ class Ajax extends Template
|
||||
echo 'no action detected';
|
||||
break;
|
||||
}
|
||||
} else if (
|
||||
isset($_POST['action']) &&
|
||||
$_POST['action'] != ''
|
||||
) {
|
||||
//TODO: PRO JS VRACET DATA
|
||||
ECHO 'test';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user